aboutsummaryrefslogtreecommitdiff
path: root/lib/std/unicode.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2024-05-02 20:20:41 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-06-13 10:18:59 -0400
commit76fb2b685b202ea665b850338e353c7816f5b2bb (patch)
tree16b4b39db7541febd2b4bf92c041239bdd45f144 /lib/std/unicode.zig
parent4aa15440c7a12bcc6bc0cd589ade02295549d48c (diff)
downloadzig-76fb2b685b202ea665b850338e353c7816f5b2bb.tar.gz
zig-76fb2b685b202ea665b850338e353c7816f5b2bb.zip
std: Convert deprecated aliases to compile errors and fix usages
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` + anything in `src/`
Diffstat (limited to 'lib/std/unicode.zig')
-rw-r--r--lib/std/unicode.zig17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig
index 327c485fd7..c0edf89a1e 100644
--- a/lib/std/unicode.zig
+++ b/lib/std/unicode.zig
@@ -983,8 +983,7 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16)
return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half);
}
-/// Deprecated; renamed to utf16LeToUtf8Alloc
-pub const utf16leToUtf8Alloc = utf16LeToUtf8Alloc;
+pub const utf16leToUtf8Alloc = @compileError("deprecated; renamed to utf16LeToUtf8Alloc");
/// Caller must free returned memory.
pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 {
@@ -996,8 +995,7 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L
return result.toOwnedSlice();
}
-/// Deprecated; renamed to utf16LeToUtf8AllocZ
-pub const utf16leToUtf8AllocZ = utf16LeToUtf8AllocZ;
+pub const utf16leToUtf8AllocZ = @compileError("deprecated; renamed to utf16LeToUtf8AllocZ");
/// Caller must free returned memory.
pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 {
@@ -1067,8 +1065,7 @@ fn utf16LeToUtf8Impl(utf8: []u8, utf16le: []const u16, comptime surrogates: Surr
return dest_index;
}
-/// Deprecated; renamed to utf16LeToUtf8
-pub const utf16leToUtf8 = utf16LeToUtf8;
+pub const utf16leToUtf8 = @compileError("deprecated; renamed to utf16LeToUtf8");
pub fn utf16LeToUtf8(utf8: []u8, utf16le: []const u16) Utf16LeToUtf8Error!usize {
return utf16LeToUtf8Impl(utf8, utf16le, .cannot_encode_surrogate_half);
@@ -1189,8 +1186,7 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv
return result.toOwnedSlice();
}
-/// Deprecated; renamed to utf8ToUtf16LeAllocZ
-pub const utf8ToUtf16LeWithNull = utf8ToUtf16LeAllocZ;
+pub const utf8ToUtf16LeWithNull = @compileError("deprecated; renamed to utf8ToUtf16LeAllocZ");
pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 {
// optimistically guess that it will not require surrogate pairs
@@ -1335,7 +1331,7 @@ test utf8ToUtf16LeAllocZ {
try testing.expectError(error.InvalidUtf8, result);
}
{
- const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "This string has been designed to test the vectorized implementat" ++
+ const utf16 = try utf8ToUtf16LeAllocZ(testing.allocator, "This string has been designed to test the vectorized implementat" ++
"ion by beginning with one hundred twenty-seven ASCII characters¡");
defer testing.allocator.free(utf16);
try testing.expectEqualSlices(u8, &.{
@@ -1479,8 +1475,7 @@ fn formatUtf16Le(
try writer.writeAll(buf[0..u8len]);
}
-/// Deprecated; renamed to fmtUtf16Le
-pub const fmtUtf16le = fmtUtf16Le;
+pub const fmtUtf16le = @compileError("deprecated; renamed to fmtUtf16Le");
/// Return a Formatter for a (potentially ill-formed) UTF-16 LE string,
/// which will be converted to UTF-8 during formatting.