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`
This commit is contained in:
bors 2020-12-11 12:30:05 +00:00
commit a9f7d19a91
3 changed files with 8 additions and 2 deletions

View File

@ -414,7 +414,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if layout.abi.is_uninhabited() {
// The run-time intrinsic panics just to get a good backtrace; here we abort
// since there is no problem showing a backtrace even for aborts.
M::abort(self, format!("attempted to instantiate uninhabited type `{}`", ty))?;
M::abort(
self,
format!(
"aborted execution: attempted to instantiate uninhabited type `{}`",
ty
),
)?;
}
}
sym::simd_insert => {

View File

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | intrinsics::assert_inhabited::<T>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| attempted to instantiate uninhabited type `!`
| aborted execution: attempted to instantiate uninhabited type `!`
| inside `MaybeUninit::<!>::assume_init` at $SRC_DIR/core/src/mem/maybe_uninit.rs:LL:COL
| inside `_BAD` at $DIR/assume-type-intrinsics.rs:11:9
|