Sync from rust 4137088d9d
This commit is contained in:
commit
9a21312480
2 changed files with 6 additions and 5 deletions
|
@ -45,9 +45,9 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
|
||||||
};
|
};
|
||||||
match const_.val {
|
match const_.val {
|
||||||
ConstKind::Value(_) => {}
|
ConstKind::Value(_) => {}
|
||||||
ConstKind::Unevaluated(def, ref substs, promoted) => {
|
ConstKind::Unevaluated(unevaluated) => {
|
||||||
if let Err(err) =
|
if let Err(err) =
|
||||||
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def, substs, promoted, None)
|
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None)
|
||||||
{
|
{
|
||||||
all_constants_ok = false;
|
all_constants_ok = false;
|
||||||
match err {
|
match err {
|
||||||
|
@ -124,14 +124,14 @@ pub(crate) fn codegen_constant<'tcx>(
|
||||||
};
|
};
|
||||||
let const_val = match const_.val {
|
let const_val = match const_.val {
|
||||||
ConstKind::Value(const_val) => const_val,
|
ConstKind::Value(const_val) => const_val,
|
||||||
ConstKind::Unevaluated(def, ref substs, promoted) if fx.tcx.is_static(def.did) => {
|
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) if fx.tcx.is_static(def.did) => {
|
||||||
assert!(substs.is_empty());
|
assert!(substs.is_empty());
|
||||||
assert!(promoted.is_none());
|
assert!(promoted.is_none());
|
||||||
|
|
||||||
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
|
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
|
||||||
}
|
}
|
||||||
ConstKind::Unevaluated(def, ref substs, promoted) => {
|
ConstKind::Unevaluated(unevaluated) => {
|
||||||
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def, substs, promoted, None) {
|
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
|
||||||
Ok(const_val) => const_val,
|
Ok(const_val) => const_val,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
span_bug!(constant.span, "erroneous constant not captured by required_consts");
|
span_bug!(constant.span, "erroneous constant not captured by required_consts");
|
||||||
|
|
|
@ -276,5 +276,6 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||||
// simd_bitmask
|
// simd_bitmask
|
||||||
// simd_select
|
// simd_select
|
||||||
// simd_rem
|
// simd_rem
|
||||||
|
// simd_neg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue