Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/librustc_mir/dataflow/impls/borrowed_locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,20 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> {
fn terminator_effect(&self,
sets: &mut BlockSets<'_, Local>,
loc: Location) {
let terminator = self.mir[loc.block].terminator();
BorrowedLocalsVisitor {
sets,
}.visit_terminator(self.mir[loc.block].terminator(), loc);
}.visit_terminator(terminator, loc);
match &terminator.kind {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use if let?

// Drop terminators borrows the location
TerminatorKind::Drop { location, .. } |
TerminatorKind::DropAndReplace { location, .. } => {
if let Some(local) = find_local(location) {
Copy link
Contributor

@Centril Centril May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sets.gen(local);
}
}
_ => (),
}
}

fn propagate_call_return(
Expand Down