Replace const_error methods with Const::new_error

This commit is contained in:
Boxy 2023-07-04 14:46:32 +01:00
parent ddbc774e74
commit d30f56dbf2
15 changed files with 66 additions and 59 deletions

View file

@ -915,7 +915,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
use rustc_middle::mir::interpret::ErrorHandled;
match self.infcx.try_const_eval_resolve(param_env, unevaluated, ty, None) {
Ok(ct) => Some(ct),
Err(ErrorHandled::Reported(e)) => Some(self.tcx().const_error(ty, e.into())),
Err(ErrorHandled::Reported(e)) => Some(ty::Const::new_error(self.tcx(), e.into(), ty)),
Err(ErrorHandled::TooGeneric) => None,
}
}

View file

@ -186,11 +186,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
"missing value for assoc item in impl",
);
let error_term = match assoc_def.item.kind {
ty::AssocKind::Const => tcx
.const_error(
tcx.type_of(goal.predicate.def_id())
.subst(tcx, goal.predicate.projection_ty.substs),
guar,
ty::AssocKind::Const => ty::Const::new_error(tcx,
guar,
tcx.type_of(goal.predicate.def_id())
.subst(tcx, goal.predicate.projection_ty.substs),
)
.into(),
ty::AssocKind::Type => tcx.ty_error(guar).into(),