]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir/src/hir.rs
Rollup merge of #107095 - notriddle:notriddle/sidebar-current, r=GuillaumeGomez
[rust.git] / compiler / rustc_hir / src / hir.rs
index 56f0e0b3e7df6a9350d5fe29de95cdd1a03ea311..d6566860f8170a96d25bb96f3d2e08a56c88b6fc 100644 (file)
@@ -1787,6 +1787,14 @@ pub fn peel_blocks(&self) -> &Self {
         expr
     }
 
+    pub fn peel_borrows(&self) -> &Self {
+        let mut expr = self;
+        while let ExprKind::AddrOf(.., inner) = &expr.kind {
+            expr = inner;
+        }
+        expr
+    }
+
     pub fn can_have_side_effects(&self) -> bool {
         match self.peel_drop_temps().kind {
             ExprKind::Path(_) | ExprKind::Lit(_) => false,