Rollup merge of #94849 - ouz-a:master4, r=oli-obk
Check var scope if it exist Fixes #92893. Added helper function to check the scope of a variable, if it doesn't have a scope call delay_span_bug, which avoids us trying to get a block/scope that doesn't exist. Had to increase `ROOT_ENTRY_LIMIT` was getting tidy error
This commit is contained in:
commit
a32e0f3041
7 changed files with 41 additions and 15 deletions
|
@ -362,12 +362,9 @@ impl ScopeTree {
|
|||
self.parent_map.get(&id).cloned().map(|(p, _)| p)
|
||||
}
|
||||
|
||||
/// Returns the lifetime of the local variable `var_id`
|
||||
pub fn var_scope(&self, var_id: hir::ItemLocalId) -> Scope {
|
||||
self.var_map
|
||||
.get(&var_id)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| bug!("no enclosing scope for id {:?}", var_id))
|
||||
/// Returns the lifetime of the local variable `var_id`, if any.
|
||||
pub fn var_scope(&self, var_id: hir::ItemLocalId) -> Option<Scope> {
|
||||
self.var_map.get(&var_id).cloned()
|
||||
}
|
||||
|
||||
/// Returns the scope when the temp created by `expr_id` will be cleaned up.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue