In #95563 and #97383, we found that computing the region_scope_tree is a non-trivial cost, especially in incremental builds. I was discussing with @dingxiangfei2009 and I am of the opinion that we can probably remove the region_scope_tree entirely now that we have moved over to the MIR borrow checker (i.e., NLL). We looked over the places that the region_scope_tree is used and it seems to be primarily dealing with "when do we run destructors". I think that we could probably just store the hir-id of statements and blocks and it's not important to model the full detail of the region-scope-tree. We didn't look closely into it though and it will require some detailed examination, so for now we are filing an issue to follow up on later.
In #95563 and #97383, we found that computing the
region_scope_treeis a non-trivial cost, especially in incremental builds. I was discussing with @dingxiangfei2009 and I am of the opinion that we can probably remove theregion_scope_treeentirely now that we have moved over to the MIR borrow checker (i.e., NLL). We looked over the places that theregion_scope_treeis used and it seems to be primarily dealing with "when do we run destructors". I think that we could probably just store the hir-id of statements and blocks and it's not important to model the full detail of the region-scope-tree. We didn't look closely into it though and it will require some detailed examination, so for now we are filing an issue to follow up on later.