address review again

This commit is contained in:
b-naber 2022-09-14 15:35:24 +02:00
parent ba00189d8e
commit 6af8fb7936
20 changed files with 119 additions and 520 deletions

View file

@ -604,13 +604,11 @@ impl<'tcx> Inliner<'tcx> {
// `required_consts`, here we may not only have `ConstKind::Unevaluated`
// because we are calling `subst_and_normalize_erasing_regions`.
caller_body.required_consts.extend(
callee_body.required_consts.iter().copied().filter(|&ct| {
match ct.literal.const_for_ty() {
Some(_) => {
bug!("should never encounter ty::Unevaluated in required_consts")
}
None => true,
callee_body.required_consts.iter().copied().filter(|&ct| match ct.literal {
ConstantKind::Ty(_) => {
bug!("should never encounter ty::Unevaluated in `required_consts`")
}
ConstantKind::Val(..) | ConstantKind::Unevaluated(..) => true,
}),
);
}

View file

@ -17,13 +17,8 @@ impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {
let literal = constant.literal;
match literal {
ConstantKind::Ty(c) => match c.kind() {
ConstKind::Unevaluated(uv) => {
let literal = ConstantKind::Unevaluated(uv.expand(), c.ty());
let new_constant =
Constant { span: constant.span, user_ty: constant.user_ty, literal };
self.required_consts.push(new_constant);
}
_ => {}
ConstKind::Param(_) => {}
_ => bug!("only ConstKind::Param should be encountered here, got {:#?}", c),
},
ConstantKind::Unevaluated(..) => self.required_consts.push(*constant),
ConstantKind::Val(..) => {}