Skip to content

Commit

Permalink
std: remove remaining mentions of ziglang#425
Browse files Browse the repository at this point in the history
  • Loading branch information
wooster0 committed Sep 18, 2023
1 parent 5af5d87 commit 0b52c2e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
1 change: 0 additions & 1 deletion lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub const Token = tokenizer.Token;
pub const Tokenizer = tokenizer.Tokenizer;

/// The return type is `type` to force comptime function call execution.
/// TODO: https://github.com/ziglang/zig/issues/425
/// If not linking libc, returns struct{pub const ok = false;}
/// If linking musl libc, returns struct{pub const ok = true;}
/// If linking gnu libc (glibc), the `ok` value will be true if the target
Expand Down
1 change: 0 additions & 1 deletion lib/std/meta.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,6 @@ test "ArgsTuple forwarding" {
}
}

/// TODO: https://github.com/ziglang/zig/issues/425
pub fn globalOption(comptime name: []const u8, comptime T: type) ?T {
if (!@hasDecl(root, name))
return null;
Expand Down
20 changes: 4 additions & 16 deletions lib/std/unicode.zig
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,6 @@ pub const Utf8View = struct {
return Utf8View{ .bytes = s };
}

/// TODO: https://github.com/ziglang/zig/issues/425
pub fn initComptime(comptime s: []const u8) Utf8View {
if (comptime init(s)) |r| {
return r;
} else |err| switch (err) {
error.InvalidUtf8 => {
@compileError("invalid utf8");
},
}
}

pub fn iterator(s: Utf8View) Utf8Iterator {
return Utf8Iterator{
.bytes = s.bytes,
Expand Down Expand Up @@ -457,7 +446,7 @@ test "utf8 iterator on ascii" {
try testUtf8IteratorOnAscii();
}
fn testUtf8IteratorOnAscii() !void {
const s = Utf8View.initComptime("abc");
const s = try Utf8View.init("abc");

var it1 = s.iterator();
try testing.expect(std.mem.eql(u8, "a", it1.nextCodepointSlice().?));
Expand All @@ -477,8 +466,7 @@ test "utf8 view bad" {
try testUtf8ViewBad();
}
fn testUtf8ViewBad() !void {
// Compile-time error.
// const s3 = Utf8View.initComptime("\xfe\xf2");
try testing.expectError(error.InvalidUtf8, Utf8View.init("\xfe\xf2"));
try testing.expectError(error.InvalidUtf8, Utf8View.init("hel\xadlo"));
}

Expand All @@ -487,7 +475,7 @@ test "utf8 view ok" {
try testUtf8ViewOk();
}
fn testUtf8ViewOk() !void {
const s = Utf8View.initComptime("東京市");
const s = try Utf8View.init("東京市");

var it1 = s.iterator();
try testing.expect(std.mem.eql(u8, "東", it1.nextCodepointSlice().?));
Expand Down Expand Up @@ -598,7 +586,7 @@ test "utf8 iterator peeking" {
}

fn testUtf8Peeking() !void {
const s = Utf8View.initComptime("noël");
const s = try Utf8View.init("noël");
var it = s.iterator();

try testing.expect(std.mem.eql(u8, "n", it.nextCodepointSlice().?));
Expand Down

0 comments on commit 0b52c2e

Please sign in to comment.