Skip to content

Commit 3c58820

Browse files
committed
introduce mir::Unevaluated
1 parent 6eeefe2 commit 3c58820

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/constant.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
55
use rustc_middle::mir::interpret::{
66
read_target_uint, AllocId, ConstAllocation, ConstValue, ErrorHandled, GlobalAlloc, Scalar,
77
};
8-
use rustc_middle::ty::ConstKind;
98
use rustc_span::DUMMY_SP;
109

1110
use cranelift_codegen::ir::GlobalValueData;
@@ -42,15 +41,7 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4241
let mut all_constants_ok = true;
4342
for constant in &fx.mir.required_consts {
4443
let unevaluated = match fx.monomorphize(constant.literal) {
45-
ConstantKind::Ty(ct) => match ct.kind() {
46-
ConstKind::Unevaluated(uv) => uv.expand(),
47-
ConstKind::Value(_) => continue,
48-
ConstKind::Param(_)
49-
| ConstKind::Infer(_)
50-
| ConstKind::Bound(_, _)
51-
| ConstKind::Placeholder(_)
52-
| ConstKind::Error(_) => unreachable!("{:?}", ct),
53-
},
44+
ConstantKind::Ty(_) => unreachable!(),
5445
ConstantKind::Unevaluated(uv, _) => uv,
5546
ConstantKind::Val(..) => continue,
5647
};
@@ -118,7 +109,7 @@ pub(crate) fn codegen_constant<'tcx>(
118109
) -> CValue<'tcx> {
119110
let (const_val, ty) = match fx.monomorphize(constant.literal) {
120111
ConstantKind::Ty(const_) => unreachable!("{:?}", const_),
121-
ConstantKind::Unevaluated(ty::Unevaluated { def, substs, promoted }, ty)
112+
ConstantKind::Unevaluated(mir::Unevaluated { def, substs, promoted }, ty)
122113
if fx.tcx.is_static(def.did) =>
123114
{
124115
assert!(substs.is_empty());

0 commit comments

Comments
 (0)