diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-03-25 15:01:56 +0000 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-03-29 18:40:23 -0400 |
| commit | eee752ea5a966aafa2c22c4c4ae2ed2c741b1bab (patch) | |
| tree | 2d83d4b08bbf9c49b4682a63b6eae6cca7af856f /src/Sema.zig | |
| parent | ca1fc3827e349cae1050a2f9e6e71a2996e4241b (diff) | |
| download | zig-eee752ea5a966aafa2c22c4c4ae2ed2c741b1bab.tar.gz zig-eee752ea5a966aafa2c22c4c4ae2ed2c741b1bab.zip | |
compiler: "illegal behavior", not "undefined behavior", in errors
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index c40cfbae0d..7a30546e03 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2327,11 +2327,11 @@ fn failWithNeededComptime(sema: *Sema, block: *Block, src: LazySrcLoc, reason: ? } pub fn failWithUseOfUndef(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError { - return sema.fail(block, src, "use of undefined value here causes undefined behavior", .{}); + return sema.fail(block, src, "use of undefined value here causes illegal behavior", .{}); } pub fn failWithDivideByZero(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError { - return sema.fail(block, src, "division by zero here causes undefined behavior", .{}); + return sema.fail(block, src, "division by zero here causes illegal behavior", .{}); } fn failWithModRemNegative(sema: *Sema, block: *Block, src: LazySrcLoc, lhs_ty: Type, rhs_ty: Type) CompileError { @@ -15496,7 +15496,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai } // Depending on whether safety is enabled, we will have a slightly different strategy - // here. The `div_exact` AIR instruction causes undefined behavior if a remainder + // here. The `div_exact` AIR instruction causes illegal behavior if a remainder // is produced, so in the safety check case, it cannot be used. Instead we do a // div_trunc and check for remainder. @@ -25266,7 +25266,7 @@ fn ptrSubtract(sema: *Sema, block: *Block, src: LazySrcLoc, ptr_val: Value, byte }; if (ptr.byte_offset < byte_subtract) { return sema.failWithOwnedErrorMsg(block, msg: { - const msg = try sema.errMsg(src, "pointer computation here causes undefined behavior", .{}); + const msg = try sema.errMsg(src, "pointer computation here causes illegal behavior", .{}); errdefer msg.destroy(sema.gpa); try sema.errNote(src, msg, "resulting pointer exceeds bounds of containing value which may trigger overflow", .{}); break :msg msg; |
