Update issue-92893.stderr
This commit is contained in:
parent
e7575f9670
commit
c20bb1d59f
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.
|
||||
|
|
|
@ -701,8 +701,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let local_id = self.var_local_id(var, for_guard);
|
||||
let source_info = self.source_info(span);
|
||||
self.cfg.push(block, Statement { source_info, kind: StatementKind::StorageLive(local_id) });
|
||||
let region_scope = self.region_scope_tree.var_scope(var.local_id);
|
||||
if schedule_drop {
|
||||
// Altough there is almost always scope for given variable in corner cases
|
||||
// like #92893 we might get variable with no scope.
|
||||
if let Some(region_scope) = self.region_scope_tree.var_scope(var.local_id) && schedule_drop{
|
||||
self.schedule_drop(span, region_scope, local_id, DropKind::Storage);
|
||||
}
|
||||
Place::from(local_id)
|
||||
|
@ -710,8 +711,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
|
||||
crate fn schedule_drop_for_binding(&mut self, var: HirId, span: Span, for_guard: ForGuard) {
|
||||
let local_id = self.var_local_id(var, for_guard);
|
||||
let region_scope = self.region_scope_tree.var_scope(var.local_id);
|
||||
self.schedule_drop(span, region_scope, local_id, DropKind::Value);
|
||||
if let Some(region_scope) = self.region_scope_tree.var_scope(var.local_id) {
|
||||
self.schedule_drop(span, region_scope, local_id, DropKind::Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// Visit all of the primary bindings in a patterns, that is, visit the
|
||||
|
|
|
@ -319,7 +319,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
|
|||
self.expr_count += 1;
|
||||
|
||||
if let PatKind::Binding(..) = pat.kind {
|
||||
let scope = self.region_scope_tree.var_scope(pat.hir_id.local_id);
|
||||
let scope = self.region_scope_tree.var_scope(pat.hir_id.local_id).unwrap();
|
||||
let ty = self.fcx.typeck_results.borrow().pat_ty(pat);
|
||||
self.record(ty, pat.hir_id, Some(scope), None, pat.span, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue