Skip to content

Commit

Permalink
Extended fn diverge_cleanup to accept a span.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Feb 20, 2017
1 parent c82a4d8 commit 1293feb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
.collect();

let success = this.cfg.start_new_block();
let cleanup = this.diverge_cleanup();
let cleanup = this.diverge_cleanup(expr_span);
this.cfg.terminate(block, source_info, TerminatorKind::Call {
func: fun,
args: args,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
let bool_ty = self.hir.bool_ty();
let eq_result = self.temp(bool_ty);
let eq_block = self.cfg.start_new_block();
let cleanup = self.diverge_cleanup();
let cleanup = self.diverge_cleanup(test.span);
self.cfg.terminate(block, source_info, TerminatorKind::Call {
func: Operand::Constant(Constant {
span: test.span,
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_mir/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
debug!("pop_scope({:?}, {:?})", extent, block);
// We need to have `cached_block`s available for all the drops, so we call diverge_cleanup
// to make sure all the `cached_block`s are filled in.
self.diverge_cleanup();
self.diverge_cleanup(extent.1.span);
let scope = self.scopes.pop().unwrap();
assert_eq!(scope.extent, extent.0);
unpack!(block = build_scope_drops(&mut self.cfg,
Expand Down Expand Up @@ -564,7 +564,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// This path terminates in Resume. Returns the start of the path.
/// See module comment for more details. None indicates there’s no
/// cleanup to do at this point.
pub(crate) fn diverge_cleanup(&mut self) -> Option<BasicBlock> {
pub(crate) fn diverge_cleanup(&mut self, _span: Span) -> Option<BasicBlock> {
if !self.scopes.iter().any(|scope| scope.needs_cleanup) {
return None;
}
Expand Down Expand Up @@ -614,7 +614,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
}
let source_info = self.source_info(span);
let next_target = self.cfg.start_new_block();
let diverge_target = self.diverge_cleanup();
let diverge_target = self.diverge_cleanup(span);
self.cfg.terminate(block, source_info,
TerminatorKind::Drop {
location: location,
Expand All @@ -632,7 +632,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
value: Operand<'tcx>) -> BlockAnd<()> {
let source_info = self.source_info(span);
let next_target = self.cfg.start_new_block();
let diverge_target = self.diverge_cleanup();
let diverge_target = self.diverge_cleanup(span);
self.cfg.terminate(block, source_info,
TerminatorKind::DropAndReplace {
location: location,
Expand All @@ -655,7 +655,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
let source_info = self.source_info(span);

let success_block = self.cfg.start_new_block();
let cleanup = self.diverge_cleanup();
let cleanup = self.diverge_cleanup(span);

self.cfg.terminate(block, source_info,
TerminatorKind::Assert {
Expand Down

0 comments on commit 1293feb

Please sign in to comment.