std: fix compile errors found by stage2 AstGen

This commit is contained in:
Andrew Kelley 2021-04-29 20:33:29 -07:00
parent 8944240aec
commit 474ade88b5
5 changed files with 9 additions and 16 deletions

View File

@ -673,9 +673,6 @@ pub const Expr = struct {
base: Expr = Expr{ .id = .Infix },
lhs: *Expr,
op_token: TokenIndex,
op: Op,
rhs: *Expr,
pub const Op = enum {};
};
};

View File

@ -70,7 +70,7 @@ pub const pthread_rwlock_t = extern struct {
waiters: [2]?*c_void = [_]?*c_void{ null, null },
};
pub const EAI = extern enum(c_int) {
pub const EAI = enum(c_int) {
/// address family for hostname not supported
ADDRFAMILY = 1,

View File

@ -617,18 +617,18 @@ const Parser = struct {
return false;
};
switch (ty.id) {
.Enum => |e| blk: {
.Enum => |e| inner: {
if (e.name) |some|
if (!parser.tree.tokenEql(some, tok))
break :blk;
break :inner;
return parser.err(.{
.MustUseKwToRefer = .{ .kw = e.tok, .name = tok },
});
},
.Record => |r| blk: {
.Record => |r| inner: {
if (r.name) |some|
if (!parser.tree.tokenEql(some, tok))
break :blk;
break :inner;
return parser.err(.{
.MustUseKwToRefer = .{
.kw = r.tok,

View File

@ -348,9 +348,6 @@ test "std.meta.containerLayout" {
const E1 = enum {
A,
};
const E3 = extern enum {
A,
};
const S1 = struct {};
const S2 = packed struct {};
const S3 = extern struct {};
@ -365,7 +362,6 @@ test "std.meta.containerLayout" {
};
testing.expect(containerLayout(E1) == .Auto);
testing.expect(containerLayout(E3) == .Extern);
testing.expect(containerLayout(S1) == .Auto);
testing.expect(containerLayout(S2) == .Packed);
testing.expect(containerLayout(S3) == .Extern);
@ -1026,7 +1022,7 @@ test "std.meta.cast" {
testing.expectEqual(@intToPtr(?*c_void, 2), cast(?*c_void, @intToPtr(*u8, 2)));
const C_ENUM = extern enum(c_int) {
const C_ENUM = enum(c_int) {
A = 0,
B,
C,
@ -1109,7 +1105,7 @@ pub fn sizeof(target: anytype) usize {
}
test "sizeof" {
const E = extern enum(c_int) { One, _ };
const E = enum(c_int) { One, _ };
const S = extern struct { a: u32 };
const ptr_size = @sizeOf(*c_void);

View File

@ -497,8 +497,8 @@ pub fn hasDecls(comptime T: type, comptime names: anytype) bool {
test "std.meta.trait.hasDecls" {
const TestStruct1 = struct {};
const TestStruct2 = struct {
pub var a: u32;
pub var b: u32;
pub var a: u32 = undefined;
pub var b: u32 = undefined;
c: bool,
pub fn useless() void {}
};