Auto merge of #1029 - RalfJung:panic-if-uninhabited, r=RalfJung

calling panic_if_uninhabited is not actually UB
This commit is contained in:
bors 2019-11-03 14:40:15 +00:00
commit 727e77844e

View file

@ -381,7 +381,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let ty = substs.type_at(0);
let layout = this.layout_of(ty)?;
if layout.abi.is_uninhabited() {
throw_ub_format!("Trying to instantiate uninhabited type {}", ty)
// FIXME: This should throw a panic in the interpreted program instead.
throw_unsup_format!("Trying to instantiate uninhabited type {}", ty)
}
}