Make body_owned_by
return the body directly.
Almost all callers want this anyway, and now we can use it to also return fed bodies
This commit is contained in:
parent
ceb45d5519
commit
a34c26e7ec
38 changed files with 136 additions and 131 deletions
|
@ -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