In an attempt to catalog what I learned from trying to update a project from 0.11.0 to 0.12.0, I’ve made a list of deprications and a suggestion of what to change it to. Feel free to add on.
Build System Changes
exe.addModule(module) was removed. Change to exe.root_module.addImport(module)
Build.LazyPath.relative(path) was changed to give a warning. Use b.path(path) instead.
You can also use b.path(path) instead of .root_source_file = .{ .path = “src/main.zig” },
CrossTarget was removed. You can use b.resolveTargetQuery() instead with the same struct members to get a ResolvedTarget.
Language Changes
If a variable is never mutated, it is required to be const. You will probably do a lot of find and replace with var → const. This is a compiler error now.
@fabs(), std.math.fabs(), and std.math.abs() were removed. There is a new @abs builtin that is a drop in replacement for all of these.
std.mem.copy was removed. You can use either the @memcpy builtin, or std.mem.copyForwards or std.mem.copyBackwards. If the memory regions do not overlap, either of the std.mem.copy* methods should work just fine
Enum Casing: A lot of enum variants were changed to lower case names. So for example Endian used to be .Big and .Little. Now it is .big and .little. Other enums were affected as well.
std.mem.writeIntSlice* was removed. Need to figure out how to migrate this.
std.os was largely moved to std.posix.
std.c.MAP.PRIVATE was changed. Can’t figure out the right syntax to get this in 0.12.0.
Any others that I missed? I’ll keep adding as I find them. Thanks