Auto merge of #125711 - oli-obk:const_block_ice2, r=Nadrieril
Make `body_owned_by` return the `Body` instead of just the `BodyId` fixes #125677 Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly. This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too. I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
This commit is contained in:
commit
d43930dab3
54 changed files with 163 additions and 162 deletions
|
@ -818,7 +818,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
|||
resolve_block(self, b);
|
||||
}
|
||||
|
||||
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
|
||||
fn visit_body(&mut self, body: &hir::Body<'tcx>) {
|
||||
let body_id = body.id();
|
||||
let owner_id = self.tcx.hir().body_owner_def_id(body_id);
|
||||
|
||||
|
@ -896,7 +896,7 @@ pub fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
|
|||
return tcx.region_scope_tree(typeck_root_def_id);
|
||||
}
|
||||
|
||||
let scope_tree = if let Some(body_id) = tcx.hir().maybe_body_owned_by(def_id.expect_local()) {
|
||||
let scope_tree = if let Some(body) = tcx.hir().maybe_body_owned_by(def_id.expect_local()) {
|
||||
let mut visitor = RegionResolutionVisitor {
|
||||
tcx,
|
||||
scope_tree: ScopeTree::default(),
|
||||
|
@ -907,9 +907,8 @@ pub fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
|
|||
fixup_scopes: vec![],
|
||||
};
|
||||
|
||||
let body = tcx.hir().body(body_id);
|
||||
visitor.scope_tree.root_body = Some(body.value.hir_id);
|
||||
visitor.visit_body(body);
|
||||
visitor.visit_body(&body);
|
||||
visitor.scope_tree
|
||||
} else {
|
||||
ScopeTree::default()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue