Auto merge of #1226 - RalfJung:rustup, r=RalfJung

rustup, fix for intrinsic rename and transmute error change

@bors r+
This commit is contained in:
bors 2020-03-14 08:28:43 +00:00
commit 2a056a7a3b
3 changed files with 7 additions and 7 deletions

View File

@ -1 +1 @@
54b7d21f59a363e53eb1c31d76b40af2ff99321c
1572c433eed495d0ade41511ae106b180e02851d

View File

@ -438,20 +438,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
this.write_scalar(result_ptr, dest)?;
}
"panic_if_uninhabited" |
"panic_if_zero_invalid" |
"panic_if_any_invalid" => {
"assert_inhabited" |
"assert_zero_valid" |
"assert_uninit_valid" => {
let ty = substs.type_at(0);
let layout = this.layout_of(ty)?;
if layout.abi.is_uninhabited() {
// Return here because we paniced instead of returning normally from the intrinsic.
return this.start_panic(&format!("attempted to instantiate uninhabited type `{}`", ty), unwind);
}
if intrinsic_name == "panic_if_zero_invalid" && !layout.might_permit_raw_init(this, /*zero:*/ true).unwrap() {
if intrinsic_name == "assert_zero_valid" && !layout.might_permit_raw_init(this, /*zero:*/ true).unwrap() {
// Return here because we paniced instead of returning normally from the intrinsic.
return this.start_panic(&format!("attempted to zero-initialize type `{}`, which is invalid", ty), unwind);
}
if intrinsic_name == "panic_if_any_invalid" && !layout.might_permit_raw_init(this, /*zero:*/ false).unwrap() {
if intrinsic_name == "assert_uninit_valid" && !layout.might_permit_raw_init(this, /*zero:*/ false).unwrap() {
// Return here because we paniced instead of returning normally from the intrinsic.
return this.start_panic(&format!("attempted to leave type `{}` uninitialized, which is invalid", ty), unwind);
}

View File

@ -7,6 +7,6 @@ struct Human;
fn main() {
let _x: ! = unsafe {
std::mem::transmute::<Human, !>(Human) //~ ERROR entering unreachable code
std::mem::transmute::<Human, !>(Human) //~ ERROR transmuting to uninhabited
};
}