1
Fork 0

extract ConstKind::Unevaluated into a struct

This commit is contained in:
lcnr 2021-03-12 00:01:34 +01:00
parent 41b315a470
commit 43ebac119b
25 changed files with 131 additions and 88 deletions

View file

@ -707,11 +707,11 @@ impl<'thir, 'tcx> Cx<'thir, 'tcx> {
// and not the beginning of discriminants (which is always `0`)
let substs = InternalSubsts::identity_for_item(self.tcx(), did);
let lhs = mk_const(self.tcx().mk_const(ty::Const {
val: ty::ConstKind::Unevaluated(
ty::WithOptConstParam::unknown(did),
val: ty::ConstKind::Unevaluated(ty::Unevaluated {
def: ty::WithOptConstParam::unknown(did),
substs,
None,
),
promoted: None,
}),
ty: var_ty,
}));
let bin =
@ -905,11 +905,11 @@ impl<'thir, 'tcx> Cx<'thir, 'tcx> {
debug!("convert_path_expr: (const) user_ty={:?}", user_ty);
ExprKind::Literal {
literal: self.tcx.mk_const(ty::Const {
val: ty::ConstKind::Unevaluated(
ty::WithOptConstParam::unknown(def_id),
val: ty::ConstKind::Unevaluated(ty::Unevaluated {
def: ty::WithOptConstParam::unknown(def_id),
substs,
None,
),
promoted: None,
}),
ty: self.typeck_results().node_type(expr.hir_id),
}),
user_ty,