# Function rustc_hir_analysis::check::region::region_scope_tree

source ·

    pub fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree

Expand description

Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body; in the case of closures, this will be redirected to the enclosing function.

Performance: This is a query rather than a simple function to enable re-use in incremental scenarios. We may sometimes need to rerun the type checker even when the HIR hasn’t changed, and in those cases we can avoid reconstructing the region scope tree.