move required_consts check to general post-mono-check function

This commit is contained in:
Ralf Jung
2023-09-11 09:52:45 +02:00
parent ccf817b9bb
commit 89ac57db4d
40 changed files with 319 additions and 257 deletions

View File

@@ -949,8 +949,10 @@ 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(ty::Const::new_error(self.tcx(), e.into(), ty)),
Err(ErrorHandled::TooGeneric) => None,
Err(ErrorHandled::Reported(e, _)) => {
Some(ty::Const::new_error(self.tcx(), e.into(), ty))
}
Err(ErrorHandled::TooGeneric(_)) => None,
}
}