Sync from rust 0ad927c0c0
This commit is contained in:
commit
087385a1e7
@ -72,7 +72,7 @@ pub(crate) fn eval_mir_constant<'tcx>(
|
|||||||
let cv = fx.monomorphize(constant.const_);
|
let cv = fx.monomorphize(constant.const_);
|
||||||
// This cannot fail because we checked all required_consts in advance.
|
// This cannot fail because we checked all required_consts in advance.
|
||||||
let val = cv
|
let val = cv
|
||||||
.eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(constant.span))
|
.eval(fx.tcx, ty::ParamEnv::reveal_all(), constant.span)
|
||||||
.expect("erroneous constant missed by mono item collection");
|
.expect("erroneous constant missed by mono item collection");
|
||||||
(val, cv.ty())
|
(val, cv.ty())
|
||||||
}
|
}
|
||||||
|
@ -728,8 +728,10 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
|||||||
| sym::variant_count => {
|
| sym::variant_count => {
|
||||||
intrinsic_args!(fx, args => (); intrinsic);
|
intrinsic_args!(fx, args => (); intrinsic);
|
||||||
|
|
||||||
let const_val =
|
let const_val = fx
|
||||||
fx.tcx.const_eval_instance(ParamEnv::reveal_all(), instance, None).unwrap();
|
.tcx
|
||||||
|
.const_eval_instance(ParamEnv::reveal_all(), instance, source_info.span)
|
||||||
|
.unwrap();
|
||||||
let val = crate::constant::codegen_const_value(fx, const_val, ret.layout().ty);
|
let val = crate::constant::codegen_const_value(fx, const_val, ret.layout().ty);
|
||||||
ret.write_cvalue(fx, val);
|
ret.write_cvalue(fx, val);
|
||||||
}
|
}
|
||||||
@ -755,13 +757,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
|||||||
ret.write_cvalue(fx, val);
|
ret.write_cvalue(fx, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
sym::ptr_guaranteed_cmp => {
|
|
||||||
intrinsic_args!(fx, args => (a, b); intrinsic);
|
|
||||||
|
|
||||||
let val = crate::num::codegen_ptr_binop(fx, BinOp::Eq, a, b).load_scalar(fx);
|
|
||||||
ret.write_cvalue(fx, CValue::by_val(val, fx.layout_of(fx.tcx.types.u8)));
|
|
||||||
}
|
|
||||||
|
|
||||||
sym::caller_location => {
|
sym::caller_location => {
|
||||||
intrinsic_args!(fx, args => (); intrinsic);
|
intrinsic_args!(fx, args => (); intrinsic);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
|||||||
|
|
||||||
let idx = generic_args[2]
|
let idx = generic_args[2]
|
||||||
.expect_const()
|
.expect_const()
|
||||||
.eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(span))
|
.eval(fx.tcx, ty::ParamEnv::reveal_all(), span)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap_branch();
|
.unwrap_branch();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user