Commit 413577c881
Changed files (7)
lib
lib/std/io/bit_reader.zig
@@ -87,13 +87,9 @@ pub fn BitReader(endian: std.builtin.Endian, comptime ReaderType: type) type {
//copy bytes until we have enough bits, then leave the rest in bit_buffer
while (out_bits.* < bits) {
const n = bits - out_bits.*;
- const next_byte = self.forward_reader.readByte() catch |err| {
- if (err == error.EndOfStream) {
- return @intCast(U, out_buffer);
- }
- //@BUG: See #1810. Not sure if the bug is that I have to do this for some
- // streams, or that I don't for streams with emtpy errorsets.
- return @errSetCast(Error, err);
+ const next_byte = self.forward_reader.readByte() catch |err| switch (err) {
+ error.EndOfStream => return @intCast(U, out_buffer),
+ else => |e| return e,
};
switch (endian) {
lib/std/io/stream_source.zig
@@ -114,6 +114,7 @@ test "StreamSource (mutable buffer)" {
}
test "StreamSource (const buffer)" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
const buffer: [64]u8 = "Hello, World!".* ++ ([1]u8{0xAA} ** 51);
var source = StreamSource{ .const_buffer = std.io.fixedBufferStream(&buffer) };
lib/std/math/big/rational.zig
@@ -573,6 +573,7 @@ test "big.rational setFloatString" {
}
test "big.rational toFloat" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -586,6 +587,7 @@ test "big.rational toFloat" {
}
test "big.rational set/to Float round-trip" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
var a = try Rational.init(testing.allocator);
defer a.deinit();
var prng = std.rand.DefaultPrng.init(0x5EED);
lib/std/net/test.zig
@@ -5,6 +5,7 @@ const mem = std.mem;
const testing = std.testing;
test "parse and render IPv6 addresses" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
var buffer: [100]u8 = undefined;
@@ -67,6 +68,7 @@ test "invalid but parseable IPv6 scope ids" {
}
test "parse and render IPv4 addresses" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
var buffer: [18]u8 = undefined;
@@ -91,6 +93,7 @@ test "parse and render IPv4 addresses" {
}
test "parse and render UNIX addresses" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
if (!net.has_unix_sockets) return error.SkipZigTest;
@@ -104,6 +107,7 @@ test "parse and render UNIX addresses" {
}
test "resolve DNS" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
if (builtin.os.tag == .windows) {
lib/std/net.zig
@@ -1342,7 +1342,8 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void {
};
defer file.close();
- const stream = std.io.bufferedReader(file.reader()).reader();
+ var buf_reader = std.io.bufferedReader(file.reader());
+ const stream = buf_reader.reader();
var line_buf: [512]u8 = undefined;
while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) {
error.StreamTooLong => blk: {
@@ -1353,7 +1354,10 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void {
},
else => |e| return e,
}) |line| {
- const no_comment_line = mem.split(u8, line, "#").next().?;
+ const no_comment_line = no_comment_line: {
+ var split = mem.split(u8, line, "#");
+ break :no_comment_line split.next().?;
+ };
var line_it = mem.tokenize(u8, no_comment_line, " \t");
const token = line_it.next() orelse continue;
@@ -1363,7 +1367,8 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void {
const name = colon_it.next().?;
const value_txt = colon_it.next() orelse continue;
const value = std.fmt.parseInt(u8, value_txt, 10) catch |err| switch (err) {
- error.Overflow => 255,
+ // TODO https://github.com/ziglang/zig/issues/11812
+ error.Overflow => @as(u8, 255),
error.InvalidCharacter => continue,
};
if (mem.eql(u8, name, "ndots")) {
lib/std/priority_queue.zig
@@ -399,6 +399,7 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {
}
test "std.PriorityQueue: fromOwnedSlice" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
const heap_items = try testing.allocator.dupe(u32, items[0..]);
var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});
lib/std/simd.zig
@@ -160,6 +160,7 @@ pub fn extract(
}
test "vector patterns" {
+ if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
const base = @Vector(4, u32){ 10, 20, 30, 40 };
const other_base = @Vector(4, u32){ 55, 66, 77, 88 };