make unevaluated const substs optional
This commit is contained in:
parent
21fff2c6c3
commit
e0ea466661
@ -129,13 +129,13 @@ 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(ty::Unevaluated { def, substs, promoted })
|
ConstKind::Unevaluated(uv)
|
||||||
if fx.tcx.is_static(def.did) =>
|
if fx.tcx.is_static(uv.def.did) =>
|
||||||
{
|
{
|
||||||
assert!(substs.is_empty());
|
assert!(uv.substs(fx.tcx).is_empty());
|
||||||
assert!(promoted.is_none());
|
assert!(uv.promoted.is_none());
|
||||||
|
|
||||||
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
|
return codegen_static_ref(fx, uv.def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
|
||||||
}
|
}
|
||||||
ConstKind::Unevaluated(unevaluated) => {
|
ConstKind::Unevaluated(unevaluated) => {
|
||||||
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
|
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user