Skip to content

Commit d980c6a

Browse files
authored
Merge pull request #11899 from Vexu/stage2
Stage2: fixes for std tests
2 parents ca98625 + d0d5052 commit d980c6a

File tree

8 files changed

+8
-16
lines changed

8 files changed

+8
-16
lines changed

lib/std/crypto/argon2.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ test "kdf" {
897897
}
898898

899899
test "phc format hasher" {
900-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
901900
const allocator = std.testing.allocator;
902901
const password = "testpass";
903902

@@ -913,7 +912,6 @@ test "phc format hasher" {
913912
}
914913

915914
test "password hash and password verify" {
916-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
917915
const allocator = std.testing.allocator;
918916
const password = "testpass";
919917

lib/std/crypto/bcrypt.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ test "bcrypt crypt format" {
802802
}
803803

804804
test "bcrypt phc format" {
805-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
806805
const hash_options = HashOptions{
807806
.params = .{ .rounds_log = 5 },
808807
.encoding = .phc,

lib/std/crypto/phc_encoding.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn BinValue(comptime max_len: usize) type {
4141
}
4242

4343
/// Return the slice containing the actual value.
44-
pub fn constSlice(self: Self) []const u8 {
44+
pub fn constSlice(self: *const Self) []const u8 {
4545
return self.buf[0..self.len];
4646
}
4747

@@ -52,7 +52,7 @@ pub fn BinValue(comptime max_len: usize) type {
5252
self.len = len;
5353
}
5454

55-
fn toB64(self: Self, buf: []u8) ![]const u8 {
55+
fn toB64(self: *const Self, buf: []u8) ![]const u8 {
5656
const value = self.constSlice();
5757
const len = B64Encoder.calcSize(value.len);
5858
if (len > buf.len) return Error.NoSpaceLeft;
@@ -260,7 +260,6 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {
260260
}
261261

262262
test "phc format - encoding/decoding" {
263-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
264263
const Input = struct {
265264
str: []const u8,
266265
HashResult: type,

lib/std/crypto/scrypt.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const crypt_format = struct {
248248
}
249249

250250
/// Return the slice containing the actual value.
251-
pub fn constSlice(self: Self) []const u8 {
251+
pub fn constSlice(self: *const Self) []const u8 {
252252
return self.buf[0..self.len];
253253
}
254254

@@ -259,7 +259,7 @@ const crypt_format = struct {
259259
self.len = len;
260260
}
261261

262-
fn toB64(self: Self, buf: []u8) ![]const u8 {
262+
fn toB64(self: *const Self, buf: []u8) ![]const u8 {
263263
const value = self.constSlice();
264264
const len = Codec.encodedLen(value.len);
265265
if (len > buf.len) return EncodingError.NoSpaceLeft;
@@ -683,7 +683,6 @@ test "unix-scrypt" {
683683
}
684684

685685
test "crypt format" {
686-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
687686
const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
688687
const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
689688
var buf: [str.len]u8 = undefined;

lib/std/fmt.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,18 +2117,18 @@ test "escape non-printable" {
21172117
}
21182118

21192119
test "pointer" {
2120+
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
21202121
{
21212122
const value = @intToPtr(*align(1) i32, 0xdeadbeef);
21222123
try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value});
21232124
try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
21242125
}
2125-
if (builtin.zig_backend != .stage1) return error.SkipZigTest;
21262126
{
2127-
const value = @intToPtr(fn () void, 0xdeadbeef);
2127+
const value = @intToPtr(*const fn () void, 0xdeadbeef);
21282128
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
21292129
}
21302130
{
2131-
const value = @intToPtr(fn () void, 0xdeadbeef);
2131+
const value = @intToPtr(*const fn () void, 0xdeadbeef);
21322132
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
21332133
}
21342134
}

lib/std/mem.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,6 @@ fn testReadIntImpl() !void {
20802080
}
20812081

20822082
test "writeIntSlice" {
2083-
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; // TODO
20842083
try testWriteIntImpl();
20852084
comptime try testWriteIntImpl();
20862085
}

src/codegen/c.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ fn formatIdent(
225225
}
226226

227227
pub fn fmtIdent(ident: []const u8) std.fmt.Formatter(formatIdent) {
228-
if (builtin.zig_backend != .stage1) {
229-
@panic("TODO");
230-
}
231228
return .{ .data = ident };
232229
}
233230

src/value.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,7 @@ pub const Value = extern union {
24142414
return false;
24152415
},
24162416
.@"union" => return val.cast(Payload.Union).?.data.val.canMutateComptimeVarState(),
2417+
.slice => return val.castTag(.slice).?.data.ptr.canMutateComptimeVarState(),
24172418
else => return false,
24182419
}
24192420
}

0 commit comments

Comments
 (0)