| author | |
| committer | |
| log | 18c1007a34e92c69fa87d3f2628fa076fae7941c |
| tree | 8a70e881ae3362ada3379191b3afd2d9f1b59441 |
| parent | f8b8f50b633babb9d8e8a17a70a214057274f2a0 |
6 files changed, 57 insertions(+), 36 deletions(-)
lib/std/debug.zig-1| ... | ... | @@ -896,7 +896,6 @@ fn printLineFromFileAnyOs(out_stream: anytype, line_info: LineInfo) !void { |
| 896 | 896 | var buf: [mem.page_size]u8 = undefined; |
| 897 | 897 | var line: usize = 1; |
| 898 | 898 | var column: usize = 1; |
| 899 | var abs_index: usize = 0; | |
| 900 | 899 | while (true) { |
| 901 | 900 | const amt_read = try f.read(buf[0..]); |
| 902 | 901 | const slice = buf[0..amt_read]; |
lib/std/pdb.zig+4-2| ... | ... | @@ -590,7 +590,8 @@ pub const Pdb = struct { |
| 590 | 590 | |
| 591 | 591 | var sect_cont_offset: usize = 0; |
| 592 | 592 | if (section_contrib_size != 0) { |
| 593 | const version = reader.readEnum(SectionContrSubstreamVersion, .Little) catch |err| switch (err) { | |
| 593 | // the version | |
| 594 | _ = reader.readEnum(SectionContrSubstreamVersion, .Little) catch |err| switch (err) { | |
| 594 | 595 | error.InvalidValue => return error.InvalidDebugInfo, |
| 595 | 596 | else => |e| return e, |
| 596 | 597 | }; |
| ... | ... | @@ -616,7 +617,8 @@ pub const Pdb = struct { |
| 616 | 617 | |
| 617 | 618 | // Parse the InfoStreamHeader. |
| 618 | 619 | const version = try reader.readIntLittle(u32); |
| 619 | const signature = try reader.readIntLittle(u32); | |
| 620 | // The signature | |
| 621 | _ = try reader.readIntLittle(u32); | |
| 620 | 622 | const age = try reader.readIntLittle(u32); |
| 621 | 623 | const guid = try reader.readBytesNoEof(16); |
| 622 | 624 |
lib/std/zig/parse.zig+2-2| ... | ... | @@ -1005,7 +1005,7 @@ const Parser = struct { |
| 1005 | 1005 | }, |
| 1006 | 1006 | }); |
| 1007 | 1007 | }; |
| 1008 | const else_payload = try p.parsePayload(); | |
| 1008 | _ = try p.parsePayload(); | |
| 1009 | 1009 | const else_expr = try p.expectStatement(); |
| 1010 | 1010 | return p.addNode(.{ |
| 1011 | 1011 | .tag = .@"if", |
| ... | ... | @@ -1189,7 +1189,7 @@ const Parser = struct { |
| 1189 | 1189 | }); |
| 1190 | 1190 | } |
| 1191 | 1191 | }; |
| 1192 | const else_payload = try p.parsePayload(); | |
| 1192 | _ = try p.parsePayload(); | |
| 1193 | 1193 | const else_expr = try p.expectStatement(); |
| 1194 | 1194 | return p.addNode(.{ |
| 1195 | 1195 | .tag = .@"while", |
test/stage2/cbe.zig+27-22| ... | ... | @@ -93,16 +93,16 @@ pub fn addCases(ctx: *TestContext) !void { |
| 93 | 93 | , ""); |
| 94 | 94 | case.addError( |
| 95 | 95 | \\pub export fn main() c_int { |
| 96 | \\ const c = @intToError(0); | |
| 96 | \\ _ = @intToError(0); | |
| 97 | 97 | \\ return 0; |
| 98 | 98 | \\} |
| 99 | , &.{":2:27: error: integer value 0 represents no error"}); | |
| 99 | , &.{":2:21: error: integer value 0 represents no error"}); | |
| 100 | 100 | case.addError( |
| 101 | 101 | \\pub export fn main() c_int { |
| 102 | \\ const c = @intToError(3); | |
| 102 | \\ _ = @intToError(3); | |
| 103 | 103 | \\ return 0; |
| 104 | 104 | \\} |
| 105 | , &.{":2:27: error: integer value 3 represents no error"}); | |
| 105 | , &.{":2:21: error: integer value 3 represents no error"}); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | { |
| ... | ... | @@ -383,6 +383,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 383 | 383 | \\ true => 2, |
| 384 | 384 | \\ false => 3, |
| 385 | 385 | \\ }; |
| 386 | \\ _ = b; | |
| 386 | 387 | \\} |
| 387 | 388 | , &.{ |
| 388 | 389 | ":6:9: error: duplicate switch value", |
| ... | ... | @@ -398,6 +399,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 398 | 399 | \\ f64, i32 => 3, |
| 399 | 400 | \\ else => 4, |
| 400 | 401 | \\ }; |
| 402 | \\ _ = b; | |
| 401 | 403 | \\} |
| 402 | 404 | , &.{ |
| 403 | 405 | ":6:14: error: duplicate switch value", |
| ... | ... | @@ -414,6 +416,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 414 | 416 | \\ f16...f64 => 3, |
| 415 | 417 | \\ else => 4, |
| 416 | 418 | \\ }; |
| 419 | \\ _ = b; | |
| 417 | 420 | \\} |
| 418 | 421 | , &.{ |
| 419 | 422 | ":3:30: error: ranges not allowed when switching on type 'type'", |
| ... | ... | @@ -431,6 +434,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 431 | 434 | \\ 3 => 40, |
| 432 | 435 | \\ else => 50, |
| 433 | 436 | \\ }; |
| 437 | \\ _ = b; | |
| 434 | 438 | \\} |
| 435 | 439 | , &.{ |
| 436 | 440 | ":8:14: error: unreachable else prong; all cases already handled", |
| ... | ... | @@ -556,10 +560,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 556 | 560 | \\const E1 = packed enum { a, b, c }; |
| 557 | 561 | \\const E2 = extern enum { a, b, c }; |
| 558 | 562 | \\export fn foo() void { |
| 559 | \\ const x = E1.a; | |
| 563 | \\ _ = E1.a; | |
| 560 | 564 | \\} |
| 561 | 565 | \\export fn bar() void { |
| 562 | \\ const x = E2.a; | |
| 566 | \\ _ = E2.a; | |
| 563 | 567 | \\} |
| 564 | 568 | , &.{ |
| 565 | 569 | ":1:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", |
| ... | ... | @@ -579,10 +583,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 579 | 583 | \\ c, |
| 580 | 584 | \\}; |
| 581 | 585 | \\export fn foo() void { |
| 582 | \\ const x = E1.a; | |
| 586 | \\ _ = E1.a; | |
| 583 | 587 | \\} |
| 584 | 588 | \\export fn bar() void { |
| 585 | \\ const x = E2.a; | |
| 589 | \\ _ = E2.a; | |
| 586 | 590 | \\} |
| 587 | 591 | , &.{ |
| 588 | 592 | ":3:5: error: enum fields cannot be marked comptime", |
| ... | ... | @@ -621,7 +625,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 621 | 625 | \\ c, |
| 622 | 626 | \\}; |
| 623 | 627 | \\export fn foo() void { |
| 624 | \\ const x = E1.a; | |
| 628 | \\ _ = E1.a; | |
| 625 | 629 | \\} |
| 626 | 630 | , &.{ |
| 627 | 631 | ":3:7: error: expected ',', found 'align'", |
| ... | ... | @@ -638,7 +642,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 638 | 642 | \\ _, |
| 639 | 643 | \\}; |
| 640 | 644 | \\export fn foo() void { |
| 641 | \\ const x = E1.a; | |
| 645 | \\ _ = E1.a; | |
| 642 | 646 | \\} |
| 643 | 647 | , &.{ |
| 644 | 648 | ":6:5: error: redundant non-exhaustive enum mark", |
| ... | ... | @@ -653,7 +657,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 653 | 657 | \\ _ = 10, |
| 654 | 658 | \\}; |
| 655 | 659 | \\export fn foo() void { |
| 656 | \\ const x = E1.a; | |
| 660 | \\ _ = E1.a; | |
| 657 | 661 | \\} |
| 658 | 662 | , &.{ |
| 659 | 663 | ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", |
| ... | ... | @@ -662,7 +666,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 662 | 666 | case.addError( |
| 663 | 667 | \\const E1 = enum {}; |
| 664 | 668 | \\export fn foo() void { |
| 665 | \\ const x = E1.a; | |
| 669 | \\ _ = E1.a; | |
| 666 | 670 | \\} |
| 667 | 671 | , &.{ |
| 668 | 672 | ":1:12: error: enum declarations must have at least one tag", |
| ... | ... | @@ -671,7 +675,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 671 | 675 | case.addError( |
| 672 | 676 | \\const E1 = enum { a, b, _ }; |
| 673 | 677 | \\export fn foo() void { |
| 674 | \\ const x = E1.a; | |
| 678 | \\ _ = E1.a; | |
| 675 | 679 | \\} |
| 676 | 680 | , &.{ |
| 677 | 681 | ":1:12: error: non-exhaustive enum missing integer tag type", |
| ... | ... | @@ -681,7 +685,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 681 | 685 | case.addError( |
| 682 | 686 | \\const E1 = enum { a, b, c, b, d }; |
| 683 | 687 | \\pub export fn main() c_int { |
| 684 | \\ const x = E1.a; | |
| 688 | \\ _ = E1.a; | |
| 685 | 689 | \\} |
| 686 | 690 | , &.{ |
| 687 | 691 | ":1:28: error: duplicate enum tag", |
| ... | ... | @@ -691,28 +695,28 @@ pub fn addCases(ctx: *TestContext) !void { |
| 691 | 695 | case.addError( |
| 692 | 696 | \\pub export fn main() c_int { |
| 693 | 697 | \\ const a = true; |
| 694 | \\ const b = @enumToInt(a); | |
| 698 | \\ _ = @enumToInt(a); | |
| 695 | 699 | \\} |
| 696 | 700 | , &.{ |
| 697 | ":3:26: error: expected enum or tagged union, found bool", | |
| 701 | ":3:20: error: expected enum or tagged union, found bool", | |
| 698 | 702 | }); |
| 699 | 703 | |
| 700 | 704 | case.addError( |
| 701 | 705 | \\pub export fn main() c_int { |
| 702 | 706 | \\ const a = 1; |
| 703 | \\ const b = @intToEnum(bool, a); | |
| 707 | \\ _ = @intToEnum(bool, a); | |
| 704 | 708 | \\} |
| 705 | 709 | , &.{ |
| 706 | ":3:26: error: expected enum, found bool", | |
| 710 | ":3:20: error: expected enum, found bool", | |
| 707 | 711 | }); |
| 708 | 712 | |
| 709 | 713 | case.addError( |
| 710 | 714 | \\const E = enum { a, b, c }; |
| 711 | 715 | \\pub export fn main() c_int { |
| 712 | \\ const b = @intToEnum(E, 3); | |
| 716 | \\ _ = @intToEnum(E, 3); | |
| 713 | 717 | \\} |
| 714 | 718 | , &.{ |
| 715 | ":3:15: error: enum 'test_case.E' has no tag with value 3", | |
| 719 | ":3:9: error: enum 'test_case.E' has no tag with value 3", | |
| 716 | 720 | ":1:11: note: enum declared here", |
| 717 | 721 | }); |
| 718 | 722 | |
| ... | ... | @@ -780,10 +784,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 780 | 784 | case.addError( |
| 781 | 785 | \\const E = enum { a, b, c }; |
| 782 | 786 | \\pub export fn main() c_int { |
| 783 | \\ var x = E.d; | |
| 787 | \\ _ = E.d; | |
| 784 | 788 | \\} |
| 785 | 789 | , &.{ |
| 786 | ":3:14: error: enum 'test_case.E' has no member named 'd'", | |
| 790 | ":3:10: error: enum 'test_case.E' has no member named 'd'", | |
| 787 | 791 | ":1:11: note: enum declared here", |
| 788 | 792 | }); |
| 789 | 793 | |
| ... | ... | @@ -791,6 +795,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 791 | 795 | \\const E = enum { a, b, c }; |
| 792 | 796 | \\pub export fn main() c_int { |
| 793 | 797 | \\ var x: E = .d; |
| 798 | \\ _ = x; | |
| 794 | 799 | \\} |
| 795 | 800 | , &.{ |
| 796 | 801 | ":3:17: error: enum 'test_case.E' has no field named 'd'", |
test/stage2/test.zig+15-9| ... | ... | @@ -259,6 +259,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 259 | 259 | case.addCompareOutput( |
| 260 | 260 | \\pub fn main() void { |
| 261 | 261 | \\ var x: usize = 0; |
| 262 | \\ _ = x; | |
| 262 | 263 | \\ const z = @TypeOf(x, @as(u128, 5)); |
| 263 | 264 | \\ assert(z == u128); |
| 264 | 265 | \\} |
| ... | ... | @@ -283,9 +284,9 @@ pub fn addCases(ctx: *TestContext) !void { |
| 283 | 284 | ); |
| 284 | 285 | case.addError( |
| 285 | 286 | \\pub fn main() void { |
| 286 | \\ const z = @TypeOf(true, 1); | |
| 287 | \\ _ = @TypeOf(true, 1); | |
| 287 | 288 | \\} |
| 288 | , &[_][]const u8{":2:15: error: incompatible types: 'bool' and 'comptime_int'"}); | |
| 289 | , &[_][]const u8{":2:9: error: incompatible types: 'bool' and 'comptime_int'"}); | |
| 289 | 290 | } |
| 290 | 291 | |
| 291 | 292 | { |
| ... | ... | @@ -746,6 +747,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 746 | 747 | \\ \\ cool thx |
| 747 | 748 | \\ \\ |
| 748 | 749 | \\ ; |
| 750 | \\ _ = ignore; | |
| 749 | 751 | \\ add('ぁ', '\x03'); |
| 750 | 752 | \\} |
| 751 | 753 | \\ |
| ... | ... | @@ -987,6 +989,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 987 | 989 | \\ return bar; |
| 988 | 990 | \\ } |
| 989 | 991 | \\ }; |
| 992 | \\ _ = S; | |
| 990 | 993 | \\} |
| 991 | 994 | , &.{ |
| 992 | 995 | ":5:20: error: 'bar' not accessible from inner function", |
| ... | ... | @@ -1072,6 +1075,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1072 | 1075 | \\ @compileLog(b, 20, f, x); |
| 1073 | 1076 | \\ @compileLog(1000); |
| 1074 | 1077 | \\ var bruh: usize = true; |
| 1078 | \\ _ = bruh; | |
| 1075 | 1079 | \\ unreachable; |
| 1076 | 1080 | \\} |
| 1077 | 1081 | \\export fn other() void { |
| ... | ... | @@ -1217,6 +1221,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1217 | 1221 | case.addError( |
| 1218 | 1222 | \\pub fn main() void { |
| 1219 | 1223 | \\ var x = null; |
| 1224 | \\ _ = x; | |
| 1220 | 1225 | \\} |
| 1221 | 1226 | , &[_][]const u8{ |
| 1222 | 1227 | ":2:9: error: variable of type '@Type(.Null)' must be const or comptime", |
| ... | ... | @@ -1456,14 +1461,14 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1456 | 1461 | case.addCompareOutput( |
| 1457 | 1462 | \\pub fn main() void { |
| 1458 | 1463 | \\ const E = error{ A, B, D } || error { A, B, C }; |
| 1459 | \\ const a = E.A; | |
| 1460 | \\ const b = E.B; | |
| 1461 | \\ const c = E.C; | |
| 1462 | \\ const d = E.D; | |
| 1464 | \\ E.A catch {}; | |
| 1465 | \\ E.B catch {}; | |
| 1466 | \\ E.C catch {}; | |
| 1467 | \\ E.D catch {}; | |
| 1463 | 1468 | \\ const E2 = error { X, Y } || @TypeOf(error.Z); |
| 1464 | \\ const x = E2.X; | |
| 1465 | \\ const y = E2.Y; | |
| 1466 | \\ const z = E2.Z; | |
| 1469 | \\ E2.X catch {}; | |
| 1470 | \\ E2.Y catch {}; | |
| 1471 | \\ E2.Z catch {}; | |
| 1467 | 1472 | \\ assert(anyerror || error { Z } == anyerror); |
| 1468 | 1473 | \\} |
| 1469 | 1474 | \\fn assert(b: bool) void { |
| ... | ... | @@ -1485,6 +1490,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1485 | 1490 | \\ [arg1] "{rdi}" (code) |
| 1486 | 1491 | \\ : "rcx", "r11", "memory" |
| 1487 | 1492 | \\ ); |
| 1493 | \\ _ = x; | |
| 1488 | 1494 | \\} |
| 1489 | 1495 | , &[_][]const u8{":4:27: error: expected type, found comptime_int"}); |
| 1490 | 1496 | } |
test/stage2/wasm.zig+9| ... | ... | @@ -76,6 +76,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 76 | 76 | \\ var i: u32 = 5; |
| 77 | 77 | \\ var y: f32 = 42.0; |
| 78 | 78 | \\ var x: u32 = 10; |
| 79 | \\ if (false) { | |
| 80 | \\ y; | |
| 81 | \\ x; | |
| 82 | \\ } | |
| 79 | 83 | \\ return i; |
| 80 | 84 | \\} |
| 81 | 85 | , "5\n"); |
| ... | ... | @@ -84,6 +88,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 84 | 88 | \\pub export fn _start() u32 { |
| 85 | 89 | \\ var i: u32 = 5; |
| 86 | 90 | \\ var y: f32 = 42.0; |
| 91 | \\ _ = y; | |
| 87 | 92 | \\ var x: u32 = 10; |
| 88 | 93 | \\ foo(i, x); |
| 89 | 94 | \\ i = x; |
| ... | ... | @@ -388,6 +393,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 388 | 393 | \\pub export fn _start() i32 { |
| 389 | 394 | \\ var number1 = Number.One; |
| 390 | 395 | \\ var number2: Number = .Two; |
| 396 | \\ if (false) { | |
| 397 | \\ number1; | |
| 398 | \\ number2; | |
| 399 | \\ } | |
| 391 | 400 | \\ const number3 = @intToEnum(Number, 2); |
| 392 | 401 | \\ |
| 393 | 402 | \\ return @enumToInt(number3); |