Instance::resolve -> Instance::try_resolve, and other nits

This commit is contained in:
Michael Goulet 2024-07-02 15:55:17 -04:00
parent 3273ccea4b
commit b1059ccda2
22 changed files with 44 additions and 27 deletions

View file

@ -389,7 +389,7 @@ impl<'tcx> Inliner<'tcx> {
// To resolve an instance its args have to be fully normalized.
let args = self.tcx.try_normalize_erasing_regions(self.param_env, args).ok()?;
let callee =
Instance::resolve(self.tcx, self.param_env, def_id, args).ok().flatten()?;
Instance::try_resolve(self.tcx, self.param_env, def_id, args).ok().flatten()?;
if let InstanceKind::Virtual(..) | InstanceKind::Intrinsic(_) = callee.def {
return None;

View file

@ -53,7 +53,7 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
trace!(?caller, ?param_env, ?args, "cannot normalize, skipping");
continue;
};
let Ok(Some(callee)) = ty::Instance::resolve(tcx, param_env, callee, args) else {
let Ok(Some(callee)) = ty::Instance::try_resolve(tcx, param_env, callee, args) else {
trace!(?callee, "cannot resolve, skipping");
continue;
};