diff --git a/src/stage1/all_types.hpp b/src/stage1/all_types.hpp index f1308f3a94..b5a7f07975 100644 --- a/src/stage1/all_types.hpp +++ b/src/stage1/all_types.hpp @@ -1192,7 +1192,6 @@ struct AstNodeAnyFrameType { struct AstNode { enum NodeType type; TokenIndex main_token; - bool already_traced_this_node; ZigType *owner; union { AstNodeFnDef fn_def; diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index a64a6e34fb..ff68198fc3 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -73,7 +73,6 @@ ErrorMsg *add_token_error(CodeGen *g, ZigType *owner, TokenIndex token, Buf *msg } ErrorMsg *add_node_error(CodeGen *g, AstNode *node, Buf *msg) { - node->already_traced_this_node = true; return add_token_error(g, node->owner, node->main_token, msg); } @@ -4473,11 +4472,6 @@ void resolve_top_level_decl(CodeGen *g, Tld *tld, AstNode *source_node, bool all break; } } - - if (g->trace_err != nullptr && source_node != nullptr && !source_node->already_traced_this_node) { - g->trace_err = add_error_note(g, g->trace_err, source_node, buf_create_from_str("referenced here")); - source_node->already_traced_this_node = true; - } } void resolve_container_usingnamespace_decls(CodeGen *g, ScopeDecls *decls_scope) { diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index acde4232a1..cc68ce0d3c 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -25274,13 +25274,6 @@ ZigType *ir_analyze(CodeGen *codegen, Stage1Zir *stage1_zir, Stage1Air *stage1_a } else { stage1_air->first_err_trace_msg = ira->codegen->trace_err; } - if (stage1_air->first_err_trace_msg != nullptr && - !old_instruction->source_node->already_traced_this_node) - { - old_instruction->source_node->already_traced_this_node = true; - stage1_air->first_err_trace_msg = add_error_note(ira->codegen, stage1_air->first_err_trace_msg, - old_instruction->source_node, buf_create_from_str("referenced here")); - } return ira->codegen->builtin_types.entry_invalid; } else if (ira->codegen->verbose_ir) { fprintf(stderr, "-> "); @@ -25306,13 +25299,6 @@ ZigType *ir_analyze(CodeGen *codegen, Stage1Zir *stage1_zir, Stage1Air *stage1_a ZigType *res_type; if (stage1_air->first_err_trace_msg != nullptr) { codegen->trace_err = stage1_air->first_err_trace_msg; - if (codegen->trace_err != nullptr && stage1_air->source_node != nullptr && - !stage1_air->source_node->already_traced_this_node) - { - stage1_air->source_node->already_traced_this_node = true; - codegen->trace_err = add_error_note(codegen, codegen->trace_err, - stage1_air->source_node, buf_create_from_str("referenced here")); - } res_type = ira->codegen->builtin_types.entry_invalid; } else if (ira->src_implicit_return_type_list.length == 0) { res_type = codegen->builtin_types.entry_unreachable; @@ -26277,11 +26263,6 @@ static Error ir_resolve_lazy_recurse(AstNode *source_node, ZigValue *val) { Error ir_resolve_lazy(CodeGen *codegen, AstNode *source_node, ZigValue *val) { Error err; if ((err = ir_resolve_lazy_raw(source_node, val))) { - if (codegen->trace_err != nullptr && source_node != nullptr && !source_node->already_traced_this_node) { - source_node->already_traced_this_node = true; - codegen->trace_err = add_error_note(codegen, codegen->trace_err, source_node, - buf_create_from_str("referenced here")); - } return err; } if (type_is_invalid(val->type)) { diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 2a79fd2f14..1802fdc284 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -412,7 +412,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:15:23: error: enum field missing: 'arst'", - "tmp.zig:27:24: note: referenced here", }); ctx.objErrStage1("field access of opaque type", @@ -505,7 +504,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions", - "tmp.zig:13:17: note: referenced here", }); ctx.objErrStage1("slice sentinel mismatch", @@ -541,7 +539,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:25: error: unions must have 1 or more fields", - "tmp.zig:11:17: note: referenced here", }); ctx.objErrStage1("@Type for exhaustive enum with zero fields", @@ -560,7 +557,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:20: error: enums must have 1 or more fields", - "tmp.zig:12:9: note: referenced here", }); ctx.objErrStage1("@Type for tagged union with extra union field", @@ -596,7 +592,6 @@ pub fn addCases(ctx: *TestContext) !void { , &[_][]const u8{ "tmp.zig:14:23: error: enum field not found: 'arst'", "tmp.zig:2:20: note: enum declared here", - "tmp.zig:27:24: note: referenced here", }); ctx.objErrStage1("@Type with undefined", @@ -812,9 +807,7 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:3:35: error: unable to evaluate constant expression", - "tmp.zig:3:9: note: referenced here", "tmp.zig:7:37: error: unable to evaluate constant expression", - "tmp.zig:7:9: note: referenced here", }); ctx.objErrStage1("extern variable has no type", @@ -911,13 +904,9 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:3:32: error: unable to evaluate constant expression", - "tmp.zig:3:9: note: referenced here", "tmp.zig:7:21: error: expected float type, found 'u32'", - "tmp.zig:7:9: note: referenced here", "tmp.zig:11:26: error: expected float type, found 'u32'", - "tmp.zig:11:9: note: referenced here", "tmp.zig:15:23: error: expected integer type, found 'f32'", - "tmp.zig:15:9: note: referenced here", }); ctx.testErrStage1("invalid float casts", @@ -939,13 +928,9 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:3:36: error: unable to evaluate constant expression", - "tmp.zig:3:9: note: referenced here", "tmp.zig:7:21: error: expected integer type, found 'f32'", - "tmp.zig:7:9: note: referenced here", "tmp.zig:11:26: error: expected int type, found 'f32'", - "tmp.zig:11:9: note: referenced here", "tmp.zig:15:25: error: expected float type, found 'u32'", - "tmp.zig:15:9: note: referenced here", }); ctx.testErrStage1("invalid assignments", @@ -1218,7 +1203,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export const foo = @typeInfo(@This()).Struct.decls; , &[_][]const u8{ "tmp.zig:1:20: error: dependency loop detected", - "tmp.zig:1:45: note: referenced here", }); ctx.objErrStage1("function call assigned to incorrect type", @@ -2154,7 +2138,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8'", - "tmp.zig:2:17: note: referenced here", }); ctx.objErrStage1("bit shifting only works on integer types", @@ -2164,7 +2147,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8'", - "tmp.zig:2:27: note: referenced here", }); ctx.objErrStage1("struct depends on itself via optional field", @@ -2461,7 +2443,6 @@ pub fn addCases(ctx: *TestContext) !void { , &[_][]const u8{ "tmp.zig:4:1: error: unable to determine async function frame of 'amain'", "tmp.zig:5:10: note: analysis of function 'other' depends on the frame", - "tmp.zig:8:13: note: referenced here", }); ctx.objErrStage1("async function depends on its own frame", @@ -2474,7 +2455,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet", - "tmp.zig:5:13: note: referenced here", }); ctx.objErrStage1("non async function pointer passed to @asyncCall", @@ -2697,7 +2677,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches", - "tmp.zig:5:18: note: referenced here", }); ctx.objErrStage1("@ptrToInt 0 to non optional pointer", @@ -2874,7 +2853,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:1:13: error: struct 'Foo' depends on itself", - "tmp.zig:8:28: note: referenced here", }); ctx.objErrStage1("enum field value references enum", @@ -2900,8 +2878,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:2:19: error: dependency loop detected", - "tmp.zig:1:19: note: referenced here", - "tmp.zig:4:15: note: referenced here", }); ctx.testErrStage1("not an enum type", @@ -5835,7 +5811,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: division by zero", - "tmp.zig:1:14: note: referenced here", }); ctx.objErrStage1("branch on undefined value", @@ -6216,8 +6191,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } , &[_][]const u8{ "tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches", - "tmp.zig:1:37: note: referenced here", - "tmp.zig:6:50: note: referenced here", }); ctx.objErrStage1("@embedFile with bogus file", @@ -6254,7 +6227,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:6:26: error: unable to evaluate constant expression", - "tmp.zig:4:17: note: referenced here", }); ctx.objErrStage1("undeclared identifier error should mark fn as impure", @@ -6332,7 +6304,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:12: error: negation caused overflow", - "tmp.zig:1:14: note: referenced here", }); ctx.objErrStage1("add overflow in function evaluation", @@ -6344,7 +6315,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", - "tmp.zig:1:14: note: referenced here", }); ctx.objErrStage1("sub overflow in function evaluation", @@ -6356,7 +6326,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", - "tmp.zig:1:14: note: referenced here", }); ctx.objErrStage1("mul overflow in function evaluation", @@ -6368,7 +6337,6 @@ pub fn addCases(ctx: *TestContext) !void { \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", - "tmp.zig:1:14: note: referenced here", }); ctx.objErrStage1("truncate sign mismatch", @@ -6455,7 +6423,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:3:7: error: unable to evaluate constant expression", - "tmp.zig:16:19: note: referenced here", }); ctx.objErrStage1("bogus method call on slice", @@ -6779,7 +6746,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:10:14: error: reached unreachable code", - "tmp.zig:6:20: note: referenced here", }); ctx.objErrStage1("control flow uses comptime var at runtime", @@ -7280,8 +7246,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:1:13: error: aoeu", - "tmp.zig:3:19: note: referenced here", - "tmp.zig:7:12: note: referenced here", }); ctx.objErrStage1("float literal too large error", @@ -8205,7 +8169,6 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &[_][]const u8{ "tmp.zig:3:53: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid", - "tmp.zig:3:16: note: referenced here", }); ctx.testErrStage1("bad @splat type", @@ -8403,7 +8366,6 @@ pub fn addCases(ctx: *TestContext) !void { , &[_][]const u8{ "tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'", "tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16", - "tmp.zig:8:37: note: referenced here", }); // issue #7810