Skip to content

Commit

Permalink
Don't check for conflicting borrows of ReadForMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Sep 24, 2018
1 parent a6fad3f commit 46e247b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/librustc_mir/borrow_check/mod.rs
Expand Up @@ -499,11 +499,20 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
);
}
StatementKind::FakeRead(_, ref place) => {
self.access_place(
// Read for match doesn't access any memory and is used to
// assert that a place is safe and live. So we don't have to
// do any checks here.
//
// FIXME: Remove check that the place is initialized. This is
// needed for now because matches don't have never patterns yet.
// So this is the only place we prevent
// let x: !;
// match x {};
// from compiling.
self.check_if_path_or_subpath_is_moved(
ContextKind::FakeRead.new(location),
InitializationRequiringAction::Use,
(place, span),
(Deep, Read(ReadKind::Borrow(BorrowKind::Shared))),
LocalMutationIsAllowed::No,
flow_state,
);
}
Expand Down

0 comments on commit 46e247b

Please sign in to comment.