1
Fork 0

make unevaluated const substs optional

This commit is contained in:
lcnr 2021-03-16 00:05:45 +01:00
parent f4b606fd17
commit bfaf13af4e
46 changed files with 234 additions and 188 deletions

View file

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