Rollup merge of #136336 - nnethercote:overhaul-rustc_middle-util, r=jieyouxu

Overhaul `rustc_middle::util`

It's an odd module with some odd stuff in it.

r? `@Noratrieb`
This commit is contained in:
Matthias Krüger 2025-01-31 12:28:20 +01:00 committed by GitHub
commit 95f746d2ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 102 additions and 135 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 };