Sync from rust 44cfafe2fafe816395d3acc434663a45d5178c41
This commit is contained in:
commit
cceea847dd
@ -21,7 +21,8 @@ mod simd;
|
|||||||
pub(crate) use cpuid::codegen_cpuid_call;
|
pub(crate) use cpuid::codegen_cpuid_call;
|
||||||
pub(crate) use llvm::codegen_llvm_intrinsic_call;
|
pub(crate) use llvm::codegen_llvm_intrinsic_call;
|
||||||
|
|
||||||
use rustc_middle::ty::layout::HasParamEnv;
|
use rustc_middle::ty;
|
||||||
|
use rustc_middle::ty::layout::{HasParamEnv, ValidityRequirement};
|
||||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
use rustc_span::symbol::{kw, sym, Symbol};
|
use rustc_span::symbol::{kw, sym, Symbol};
|
||||||
@ -634,20 +635,17 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
|||||||
intrinsic_args!(fx, args => (); intrinsic);
|
intrinsic_args!(fx, args => (); intrinsic);
|
||||||
|
|
||||||
let ty = substs.type_at(0);
|
let ty = substs.type_at(0);
|
||||||
let layout = fx.layout_of(ty);
|
|
||||||
let do_panic = match intrinsic {
|
let requirement = ValidityRequirement::from_intrinsic(intrinsic);
|
||||||
sym::assert_inhabited => layout.abi.is_uninhabited(),
|
|
||||||
sym::assert_zero_valid => !fx
|
if let Some(requirement) = requirement {
|
||||||
|
let do_panic = !fx
|
||||||
.tcx
|
.tcx
|
||||||
.permits_zero_init(fx.param_env().and(ty))
|
.check_validity_requirement((requirement, fx.param_env().and(ty)))
|
||||||
.expect("expected to have layout during codegen"),
|
.expect("expect to have layout during codegen");
|
||||||
sym::assert_mem_uninitialized_valid => !fx
|
|
||||||
.tcx
|
|
||||||
.permits_uninit_init(fx.param_env().and(ty))
|
|
||||||
.expect("expected to have layout during codegen"),
|
|
||||||
_ => unreachable!(),
|
|
||||||
};
|
|
||||||
if do_panic {
|
if do_panic {
|
||||||
|
let layout = fx.layout_of(ty);
|
||||||
let msg_str = with_no_visible_paths!({
|
let msg_str = with_no_visible_paths!({
|
||||||
with_no_trimmed_paths!({
|
with_no_trimmed_paths!({
|
||||||
if layout.abi.is_uninhabited() {
|
if layout.abi.is_uninhabited() {
|
||||||
@ -667,6 +665,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sym::volatile_load | sym::unaligned_volatile_load => {
|
sym::volatile_load | sym::unaligned_volatile_load => {
|
||||||
intrinsic_args!(fx, args => (ptr); intrinsic);
|
intrinsic_args!(fx, args => (ptr); intrinsic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user