Skip to content

Commit

Permalink
Auto merge of #79910 - RalfJung:abort-msg, r=oli-obk
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Dec 11, 2020
2 parents 19eb1c4 + d8ee8e7 commit a9f7d19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion compiler/rustc_mir/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down

0 comments on commit a9f7d19

Please sign in to comment.