Skip to content

Commit 5cc0984

Browse files
committed
MERGEME Add fn mark_borrowed method to rustc_mir::build::Builder.
Of course this should only be kept if I actually find `mark_borrowed` called elsewhere.
1 parent 45e431c commit 5cc0984

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/librustc_mir/build/scope.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,23 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
666666

667667
success_block
668668
}
669+
670+
pub(crate) fn mark_borrowed(&mut self, extent: CodeExtent, span: Span) {
671+
let opt_scope = self.scopes
672+
.iter_mut()
673+
.find(|s| s.extent == extent);
674+
match opt_scope {
675+
None => {
676+
self.hir.tcx().sess.span_note_without_error(
677+
span,
678+
&format!("extent {:?} not found for borrow", extent));
679+
}
680+
Some(scope) => {
681+
// borrowed scopes will need to emit an EndRegion.
682+
scope.needs_cleanup = true;
683+
}
684+
}
685+
}
669686
}
670687

671688
/// Builds drops for pop_scope and exit_scope.

0 commit comments

Comments
 (0)