Skip to content

Commit 84cd57e

Browse files
committed
Extended fn diverge_cleanup to accept a span.
1 parent 92f43fe commit 84cd57e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/librustc_mir/build/expr/into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
214214
.collect();
215215

216216
let success = this.cfg.start_new_block();
217-
let cleanup = this.diverge_cleanup();
217+
let cleanup = this.diverge_cleanup(expr_span);
218218
this.cfg.terminate(block, source_info, TerminatorKind::Call {
219219
func: fun,
220220
args: args,

src/librustc_mir/build/matches/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
306306
let bool_ty = self.hir.bool_ty();
307307
let eq_result = self.temp(bool_ty);
308308
let eq_block = self.cfg.start_new_block();
309-
let cleanup = self.diverge_cleanup();
309+
let cleanup = self.diverge_cleanup(test.span);
310310
self.cfg.terminate(block, source_info, TerminatorKind::Call {
311311
func: Operand::Constant(Constant {
312312
span: test.span,

src/librustc_mir/build/scope.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
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.
320-
self.diverge_cleanup();
320+
self.diverge_cleanup(extent.1.span);
321321
let scope = self.scopes.pop().unwrap();
322322
assert_eq!(scope.extent, extent.0);
323323
unpack!(block = build_scope_drops(&mut self.cfg,
@@ -562,7 +562,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
562562
/// This path terminates in Resume. Returns the start of the path.
563563
/// See module comment for more details. None indicates there’s no
564564
/// cleanup to do at this point.
565-
pub(crate) fn diverge_cleanup(&mut self) -> Option<BasicBlock> {
565+
pub(crate) fn diverge_cleanup(&mut self, _span: Span) -> Option<BasicBlock> {
566566
if !self.scopes.iter().any(|scope| scope.needs_cleanup) {
567567
return None;
568568
}
@@ -612,7 +612,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
612612
}
613613
let source_info = self.source_info(span);
614614
let next_target = self.cfg.start_new_block();
615-
let diverge_target = self.diverge_cleanup();
615+
let diverge_target = self.diverge_cleanup(span);
616616
self.cfg.terminate(block, source_info,
617617
TerminatorKind::Drop {
618618
location: location,
@@ -630,7 +630,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
630630
value: Operand<'tcx>) -> BlockAnd<()> {
631631
let source_info = self.source_info(span);
632632
let next_target = self.cfg.start_new_block();
633-
let diverge_target = self.diverge_cleanup();
633+
let diverge_target = self.diverge_cleanup(span);
634634
self.cfg.terminate(block, source_info,
635635
TerminatorKind::DropAndReplace {
636636
location: location,
@@ -653,7 +653,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
653653
let source_info = self.source_info(span);
654654

655655
let success_block = self.cfg.start_new_block();
656-
let cleanup = self.diverge_cleanup();
656+
let cleanup = self.diverge_cleanup(span);
657657

658658
self.cfg.terminate(block, source_info,
659659
TerminatorKind::Assert {

0 commit comments

Comments
 (0)