Skip to content

Commit 441ee5c

Browse files
committed
Don't check for conflicting borrows of ReadForMatches
1 parent 1ed3010 commit 441ee5c

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
@@ -502,11 +502,20 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
502502
);
503503
}
504504
StatementKind::FakeRead(_, ref place) => {
505-
self.access_place(
505+
// Read for match doesn't access any memory and is used to
506+
// assert that a place is safe and live. So we don't have to
507+
// do any checks here.
508+
//
509+
// FIXME: Remove check that the place is initialized. This is
510+
// needed for now because matches don't have never patterns yet.
511+
// So this is the only place we prevent
512+
// let x: !;
513+
// match x {};
514+
// from compiling.
515+
self.check_if_path_or_subpath_is_moved(
506516
ContextKind::FakeRead.new(location),
517+
InitializationRequiringAction::Use,
507518
(place, span),
508-
(Deep, Read(ReadKind::Borrow(BorrowKind::Shared))),
509-
LocalMutationIsAllowed::No,
510519
flow_state,
511520
);
512521
}

0 commit comments

Comments
 (0)