zig icon indicating copy to clipboard operation
zig copied to clipboard

std: Convert deprecated aliases to compile errors and fix usages

Open squeek502 opened this issue 1 year ago • 3 comments

Deprecated aliases that are now compile errors:

  • std.fs.MAX_PATH_BYTES (renamed to std.fs.max_path_bytes)
  • std.mem.tokenize (split into tokenizeAny, tokenizeSequence, tokenizeScalar)
  • std.mem.split (split into splitSequence, splitAny, splitScalar)
  • std.mem.splitBackwards (split into splitBackwardsSequence, splitBackwardsAny, splitBackwardsScalar)
  • std.unicode
    • utf16leToUtf8Alloc, utf16leToUtf8AllocZ, utf16leToUtf8, fmtUtf16le (all renamed to have capitalized Le)
    • utf8ToUtf16LeWithNull (renamed to utf8ToUtf16LeAllocZ)
  • std.zig.CrossTarget (moved to std.Target.Query)

Deprecated lib/std/std.zig decls were deleted instead of made a @compileError because the refAllDecls in the test block would trigger the @compileError. The deleted top-level std namespaces are:

  • std.rand (renamed to std.Random)
  • std.TailQueue (renamed to std.DoublyLinkedList)
  • std.ChildProcess (renamed/moved to std.process.Child)

This is not exhaustive. Deprecated aliases that I didn't touch:

  • std.io.*
  • std.Build.*
  • std.builtin.Mode
  • std.zig.c_translation.CIntLiteralRadix
  • std.fs.Dir.writeFile (handled separately in https://github.com/ziglang/zig/pull/19844)
  • anything in src/

squeek502 avatar May 03 '24 04:05 squeek502

Better to wait and merge this later in the release cycle as it makes it more difficult to cherry pick bug fixes into the 0.12.x branch.

andrewrk avatar May 07 '24 18:05 andrewrk

Sounds good, in the meantime would a separate PR with just the callsite updates (but not the @compileErrors) be a good idea?

EDIT: Went ahead and made one just in case: https://github.com/ziglang/zig/pull/19892

squeek502 avatar May 07 '24 20:05 squeek502

The 0.12.x branch is done, so all clear to proceed with your original intent here.

andrewrk avatar May 22 '24 18:05 andrewrk

Thanks!

andrewrk avatar Jun 13 '24 14:06 andrewrk