Skip to content

Commit c82a4d8

Browse files
committed
Extended fn pop_scope to accept SourceInfo with the extent argument.
1 parent 764008e commit c82a4d8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/librustc_mir/build/block.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
5858
}));
5959

6060
if let Some(de) = opt_destruction_extent {
61-
unpack!(block = this.pop_scope(de, block));
61+
unpack!(block = this.pop_scope((de, source_info), block));
6262
}
6363
}
6464
StmtKind::Let { remainder_scope, init_scope, pattern, initializer } => {
@@ -87,7 +87,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
8787
}));
8888

8989
if let Some(de) = opt_destruction_extent {
90-
unpack!(block = this.pop_scope(de, block));
90+
unpack!(block = this.pop_scope((de, source_info), block));
9191
}
9292
} else {
9393
this.storage_live_for_bindings(block, &pattern);
@@ -111,7 +111,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
111111
// Finally, we pop all the let scopes before exiting out from the scope of block
112112
// itself.
113113
for (extent, source_info) in let_extent_stack.into_iter().rev() {
114-
unpack!(block = this.pop_scope(extent, block));
114+
unpack!(block = this.pop_scope((extent, source_info), block));
115115
if this.seen_borrows.contains(&extent) {
116116
this.cfg.push_end_region(block, source_info, extent);
117117
}
@@ -122,7 +122,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
122122
});
123123

124124
if let Some(de) = opt_destruction_extent {
125-
self.pop_scope(de, unpack!(block_and))
125+
self.pop_scope((de, source_info), unpack!(block_and))
126126
} else {
127127
block_and
128128
}

src/librustc_mir/build/scope.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
282282
debug!("in_scope(extent={:?}, block={:?})", extent, block);
283283
self.push_scope(extent.0);
284284
let rv = unpack!(block = f(self));
285-
unpack!(block = self.pop_scope(extent.0, block));
285+
unpack!(block = self.pop_scope(extent, block));
286286
if self.seen_borrows.contains(&extent.0) {
287287
self.cfg.push_end_region(block, extent.1, extent.0);
288288
}
@@ -311,15 +311,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
311311
/// drops onto the end of `block` that are needed. This must
312312
/// match 1-to-1 with `push_scope`.
313313
pub(crate) fn pop_scope(&mut self,
314-
extent: CodeExtent,
314+
extent: (CodeExtent, SourceInfo),
315315
mut block: BasicBlock)
316316
-> BlockAnd<()> {
317317
debug!("pop_scope({:?}, {:?})", extent, block);
318318
// We need to have `cached_block`s available for all the drops, so we call diverge_cleanup
319319
// to make sure all the `cached_block`s are filled in.
320320
self.diverge_cleanup();
321321
let scope = self.scopes.pop().unwrap();
322-
assert_eq!(scope.extent, extent);
322+
assert_eq!(scope.extent, extent.0);
323323
unpack!(block = build_scope_drops(&mut self.cfg,
324324
&scope,
325325
&self.scopes,

0 commit comments

Comments
 (0)