1
Fork 0

Move find_self_call.

It's a function that does stuff with MIR and yet it weirdly has its own
module in `rustc_middle::util`. This commit moves it into
`rustc_middle::mir`, a more sensible home.
This commit is contained in:
Nicholas Nethercote 2025-01-31 09:55:55 +11:00
parent 3f5e218581
commit 140817380c
6 changed files with 48 additions and 60 deletions

View file

@ -133,7 +133,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
// the `self` parameter of a method call (as the terminator of our current
// BasicBlock). If so, we emit a more specific lint.
let method_did = self.target_local.and_then(|target_local| {
rustc_middle::util::find_self_call(self.tcx, self.body, target_local, loc.block)
find_self_call(self.tcx, self.body, target_local, loc.block)
});
let lint_loc =
if method_did.is_some() { self.body.terminator_loc(loc.block) } else { loc };