Sema: make @src().line comptime-known

Reverts 89cef9f5f7.

Closes #13315
This commit is contained in:
Andrew Kelley 2023-10-23 18:35:10 -07:00
parent a07f288eb1
commit 46a6d50fdf
2 changed files with 1 additions and 21 deletions

View file

@ -16883,10 +16883,7 @@ fn zirBuiltinSrc(
// fn_name: [:0]const u8,
func_name_val,
// line: u32,
try mod.intern(.{ .runtime_value = .{
.ty = .u32_type,
.val = (try mod.intValue(Type.u32, extra.line + 1)).toIntern(),
} }),
(try mod.intValue(Type.u32, extra.line + 1)).toIntern(),
// column: u32,
(try mod.intValue(Type.u32, extra.column + 1)).toIntern(),
};

View file

@ -1,17 +0,0 @@
pub export fn entry1() void {
const s = @src();
comptime var a: []const u8 = s.file;
comptime var b: []const u8 = s.fn_name;
comptime var c: u32 = s.column;
comptime var d: u32 = s.line;
_ = a;
_ = b;
_ = c;
_ = d;
}
// error
// backend=stage2
// target=native
//
// :6:28: error: cannot store runtime value in compile time variable