Skip to content

Commit b2e4d48

Browse files
authored
Rollup merge of #71206 - RalfJung:dont-try, r=oli-obk
Miri error messages: avoid try terminology r? @oli-obk
2 parents b347097 + 250b27d commit b2e4d48

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_middle/mir/interpret/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl fmt::Debug for InvalidProgramInfo<'_> {
305305
Layout(ref err) => write!(f, "{}", err),
306306
TransmuteSizeDiff(from_ty, to_ty) => write!(
307307
f,
308-
"tried to transmute from {:?} to {:?}, but their sizes differed",
308+
"transmuting `{}` to `{}` is not possible, because these types do not have the same size",
309309
from_ty, to_ty
310310
),
311311
}
@@ -431,7 +431,7 @@ impl fmt::Debug for UndefinedBehaviorInfo {
431431
"using uninitialized data, but this operation requires initialized memory"
432432
),
433433
DeadLocal => write!(f, "accessing a dead local variable"),
434-
ReadFromReturnPlace => write!(f, "tried to read from the return place"),
434+
ReadFromReturnPlace => write!(f, "reading from return place"),
435435
}
436436
}
437437
}
@@ -462,9 +462,9 @@ impl fmt::Debug for UnsupportedOpInfo {
462462
match self {
463463
Unsupported(ref msg) => write!(f, "{}", msg),
464464
ReadForeignStatic(did) => {
465-
write!(f, "tried to read from foreign (extern) static {:?}", did)
465+
write!(f, "cannot read from foreign (extern) static {:?}", did)
466466
}
467-
NoMirFor(did) => write!(f, "could not load MIR for {:?}", did),
467+
NoMirFor(did) => write!(f, "no MIR body is available for {:?}", did),
468468
ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
469469
ReadBytesAsPointer => write!(f, "unable to turn bytes into a pointer"),
470470
}

src/test/ui/consts/transmute-size-mismatch-before-typeck.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: any use of this value will cause an error
44
LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
55
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^---
66
| |
7-
| tried to transmute from usize to &[u8], but their sizes differed
7+
| transmuting `usize` to `&[u8]` is not possible, because these types do not have the same size
88
|
99
= note: `#[deny(const_err)]` on by default
1010

0 commit comments

Comments
 (0)