about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/tcx.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-04-23 17:25:15 +0200
committerGitHub <noreply@github.com>2024-04-23 17:25:15 +0200
commit332cac2c6dbb198a725e7927d273a75ff6c6a4eb (patch)
tree1c4a7497a089b05ccba8cc1006948cf9c1546849 /compiler/rustc_middle/src/mir/tcx.rs
parent68939f78267f0d0d3dcb614d760b6638a33573a5 (diff)
parent726fb55ae29a778a698e1c880aa0ae46920ece88 (diff)
downloadrust-332cac2c6dbb198a725e7927d273a75ff6c6a4eb.tar.gz
rust-332cac2c6dbb198a725e7927d273a75ff6c6a4eb.zip
Rollup merge of #122598 - Nadrieril:full-derefpats, r=matthewjasper
deref patterns: lower deref patterns to MIR

This lowers deref patterns to MIR. This is a bit tricky because this is the first kind of pattern that requires storing a value in a temporary. Thanks to https://github.com/rust-lang/rust/pull/123324 false edges are no longer a problem.

The thing I'm not confident about is the handling of fake borrows. This PR ignores any fake borrows inside a deref pattern. We are guaranteed to at least fake borrow the place of the first pointer value, which could be enough, but I'm not certain.
Diffstat (limited to 'compiler/rustc_middle/src/mir/tcx.rs')
-rw-r--r--compiler/rustc_middle/src/mir/tcx.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs
index abe99f3e95c..ded2b93d6a1 100644
--- a/compiler/rustc_middle/src/mir/tcx.rs
+++ b/compiler/rustc_middle/src/mir/tcx.rs
@@ -294,7 +294,7 @@ impl BorrowKind {
 
             // We have no type corresponding to a shallow borrow, so use
             // `&` as an approximation.
-            BorrowKind::Fake => hir::Mutability::Not,
+            BorrowKind::Fake(_) => hir::Mutability::Not,
         }
     }
 }