Skip to content

Commit 46e247b

Browse files
committed
Don't check for conflicting borrows of ReadForMatches
1 parent a6fad3f commit 46e247b

File tree

1 file changed

+12
-3
lines changed
  • src/librustc_mir/borrow_check

1 file changed

+12
-3
lines changed

src/librustc_mir/borrow_check/mod.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,20 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
499499
);
500500
}
501501
StatementKind::FakeRead(_, ref place) => {
502-
self.access_place(
502+
// Read for match doesn't access any memory and is used to
503+
// assert that a place is safe and live. So we don't have to
504+
// do any checks here.
505+
//
506+
// FIXME: Remove check that the place is initialized. This is
507+
// needed for now because matches don't have never patterns yet.
508+
// So this is the only place we prevent
509+
// let x: !;
510+
// match x {};
511+
// from compiling.
512+
self.check_if_path_or_subpath_is_moved(
503513
ContextKind::FakeRead.new(location),
514+
InitializationRequiringAction::Use,
504515
(place, span),
505-
(Deep, Read(ReadKind::Borrow(BorrowKind::Shared))),
506-
LocalMutationIsAllowed::No,
507516
flow_state,
508517
);
509518
}

0 commit comments

Comments
 (0)