about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2018-09-13 21:36:15 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2018-09-24 23:33:13 +0100
commit46e247bcec13f3e1e850c3baffc23e64a8023ae4 (patch)
tree26d436835aa1dc6ff859b510f091c34b146f3d62
parenta6fad3f620ac14f57da080863dabcdc6b78005b1 (diff)
downloadrust-46e247bcec13f3e1e850c3baffc23e64a8023ae4.tar.gz
rust-46e247bcec13f3e1e850c3baffc23e64a8023ae4.zip
Don't check for conflicting borrows of `ReadForMatch`es
-rw-r--r--src/librustc_mir/borrow_check/mod.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 5d919e88cad..06394ee44cc 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -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,
                 );
             }