1
Fork 0

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

@ -96,7 +96,9 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
.tcx
.normalize_erasing_regions(cx.param_env, cx.typeck_results().node_args(expr.hir_id));
// Resolve the trait method instance.
let Ok(Some(i)) = ty::Instance::resolve(cx.tcx, cx.param_env, did, args) else { return };
let Ok(Some(i)) = ty::Instance::try_resolve(cx.tcx, cx.param_env, did, args) else {
return;
};
// (Re)check that it implements the noop diagnostic.
let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return };
if !matches!(