diag: preserve factual source atomic-access diagnostics
This commit is contained in:
1 parent
ee09a7a290
commit
edfef82cc6
18 files changed
+346
-9
No files matched your search
@@ -1607,8 +1607,11 @@ const Lowerer = struct {
|
||||
const r = try l.expr(x.*, null);
|
||||
const in = r.ty.inner() orelse return l.fail("E7005", e.span, "`*` reads through a borrow", &.{.{ .name = "found", .value = l.diagnosticTyText(r.ty) }});
|
||||
if (r.ty == .slice or r.ty == .slice_mut or in == .array) return l.invalid(.invalid_expression, e.span, "read slice and array elements with `s[i]`, not `*`", &.{});
|
||||
// The verifier's code (spec 15 §1 rule 2, spec 04 §28).
|
||||
if (in == .atomic) return l.fail("E4202", e.span, "an atomic cell is read only by atomic operations: use `atomic.load(r, ordering)`", &.{});
|
||||
// Source-prescribed E4202 (spec 15 §12); no load is emitted.
|
||||
if (in == .atomic) return l.fail("E4202", e.span, "an atomic cell is read only by atomic operations: use `atomic.load(r, ordering)`", &.{
|
||||
.{ .name = "found", .value = l.diagnosticTyText(r.ty) },
|
||||
.{ .name = "use", .value = "atomic.load" },
|
||||
});
|
||||
return l.def("v", in, try l.fmt("load %{s}", .{r.name}), e.span);
|
||||
},
|
||||
.index => |x| {
|
||||
|
||||
Reference in new issue
Block a user