diag: explain pointer-sized cast restrictions in source advice

This commit is contained in:
dev committed 2026-10-09 21:01:58 +03:00
1 parent 8a714ba6de
commit 6a02659f31
23 files changed
+96 -8

No files matched your search

+1 -1
View File
@@ -209,7 +209,7 @@ pub const SourceRepairKind = enum {
.borrow_argument => "Write `ref place` or `mut place` for an inline borrow argument.",
.borrow_binding => "Bind a borrow with `ref name = place;` or `mut name = place;`, rather than a let/var initializer.",
.zero_storage => "`zero` is only a whole var initializer: `var name: T = zero;`; T must be zeroable.",
.numeric_cast_modes => "Choose `as!` for a checked conversion (T0006 on overflow) or `as%` for a wrapping conversion.",
.numeric_cast_modes => "The target-independent `as` rule excludes `usize`/`isize`, even when the value fits. Choose `as!` for a checked conversion (T0006 on overflow) or `as%` for a wrapping conversion.",
};
}
+1 -1
View File
@@ -1737,7 +1737,7 @@ const Lowerer = struct {
if (x.mode == .widen) {
const a = std.meta.stringToEnum(air_module.IntType, v.ty.int).?;
const b = std.meta.stringToEnum(air_module.IntType, to.int).?;
if (a != b and !verifier_types.lossless(a, b))
if (!verifier_types.lossless(a, b))
return l.invalidWidening(e.span, &.{ .{ .name = "from", .value = v.ty.int }, .{ .name = "to", .value = to.int } });
}
const mode = switch (x.mode) {