Rollup merge of #82854 - estebank:issue-82827, r=oli-obk
Account for `if (let pat = expr) {}` Fix #82827.
This commit is contained in:
commit
6a55aa1246
9 changed files with 266 additions and 233 deletions
|
@ -1129,6 +1129,14 @@ impl Expr {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn peel_parens(&self) -> &Expr {
|
||||
let mut expr = self;
|
||||
while let ExprKind::Paren(inner) = &expr.kind {
|
||||
expr = &inner;
|
||||
}
|
||||
expr
|
||||
}
|
||||
|
||||
/// Attempts to reparse as `Ty` (for diagnostic purposes).
|
||||
pub fn to_ty(&self) -> Option<P<Ty>> {
|
||||
let kind = match &self.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue