diff options
| author | lcnr <rust@lcnr.de> | 2025-08-27 14:10:34 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-08-27 14:11:07 +0200 |
| commit | a3993c5416d69591b45d2dad4c56ce2d3a971384 (patch) | |
| tree | 67b117adccf42498e5ab02732f40697709a48dde /compiler/rustc_ty_utils/src | |
| parent | 269d5b56bcfdf2be82213e72ef9a2e4c592a8c6b (diff) | |
| download | rust-a3993c5416d69591b45d2dad4c56ce2d3a971384.tar.gz rust-a3993c5416d69591b45d2dad4c56ce2d3a971384.zip | |
change order of `nested_bodies_within`
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/nested_bodies.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/nested_bodies.rs b/compiler/rustc_ty_utils/src/nested_bodies.rs index 7c74d8eb635..11dfbad7dbb 100644 --- a/compiler/rustc_ty_utils/src/nested_bodies.rs +++ b/compiler/rustc_ty_utils/src/nested_bodies.rs @@ -22,9 +22,11 @@ impl<'tcx> Visitor<'tcx> for NestedBodiesVisitor<'tcx> { fn visit_nested_body(&mut self, id: hir::BodyId) { let body_def_id = self.tcx.hir_body_owner_def_id(id); if self.tcx.typeck_root_def_id(body_def_id.to_def_id()) == self.root_def_id { - self.nested_bodies.push(body_def_id); + // We visit nested bodies before adding the current body. This + // means that nested bodies are always stored before their parent. let body = self.tcx.hir_body(id); self.visit_body(body); + self.nested_bodies.push(body_def_id); } } } |
