Skip to content

Commit a9f7d19

Browse files
committed
Auto merge of #79910 - RalfJung:abort-msg, r=oli-obk
CTFE: tweak abort-on-uninhabited message Having an "aborted execution:" makes it more consistent with the `Abort` terminator saying "the program aborted execution". Right now, at least one of the two errors will look weird in Miri. r? `@oli-obk`
2 parents 19eb1c4 + d8ee8e7 commit a9f7d19

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

compiler/rustc_mir/src/interpret/intrinsics.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
414414
if layout.abi.is_uninhabited() {
415415
// The run-time intrinsic panics just to get a good backtrace; here we abort
416416
// since there is no problem showing a backtrace even for aborts.
417-
M::abort(self, format!("attempted to instantiate uninhabited type `{}`", ty))?;
417+
M::abort(
418+
self,
419+
format!(
420+
"aborted execution: attempted to instantiate uninhabited type `{}`",
421+
ty
422+
),
423+
)?;
418424
}
419425
}
420426
sym::simd_insert => {

src/test/ui/assume-type-intrinsics.stderr src/test/ui/consts/assume-type-intrinsics.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 | intrinsics::assert_inhabited::<T>();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
7-
| attempted to instantiate uninhabited type `!`
7+
| aborted execution: attempted to instantiate uninhabited type `!`
88
| inside `MaybeUninit::<!>::assume_init` at $SRC_DIR/core/src/mem/maybe_uninit.rs:LL:COL
99
| inside `_BAD` at $DIR/assume-type-intrinsics.rs:11:9
1010
|

0 commit comments

Comments
 (0)