Add comment for assert_inhabited in compiler/rustc_mir/src/interpret/intrinsics.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
Albin Hedman 2020-12-07 18:59:10 +01:00 committed by GitHub
parent d0a1e40eae
commit bdda98aaba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,6 +412,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let layout = self.layout_of(ty)?; let layout = self.layout_of(ty)?;
if layout.abi.is_uninhabited() { 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!("attempted to instantiate uninhabited type `{}`", ty))?;
} }
} }