diff options
| author | Ezra Shaw <ezrasure@outlook.com> | 2023-01-18 13:14:56 +1300 |
|---|---|---|
| committer | Ezra Shaw <ezrasure@outlook.com> | 2023-01-18 13:14:56 +1300 |
| commit | b73cdf1b29d25d3c6d0cc4f8a7744b08930e86ee (patch) | |
| tree | a3bdc4dc6325dff8a8b5b26cb2a70fca101ac6ed /compiler/rustc_hir/src | |
| parent | ca1178f02237fd84649a30b74052da4ef265371f (diff) | |
| download | rust-b73cdf1b29d25d3c6d0cc4f8a7744b08930e86ee.tar.gz rust-b73cdf1b29d25d3c6d0cc4f8a7744b08930e86ee.zip | |
special case removing `&` suggestion
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 60f5b79de10..5e59475a7bd 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1787,6 +1787,14 @@ impl Expr<'_> { 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, |
