Do if-expression obligation stuff less eagerly

This commit is contained in:
Michael Goulet 2022-07-21 00:03:02 +00:00
parent 3d9dd681f5
commit 99c32570bb
11 changed files with 411 additions and 350 deletions

View file

@ -954,6 +954,16 @@ pub struct Block<'hir> {
pub targeted_by_break: bool,
}
impl<'hir> Block<'hir> {
pub fn peel_blocks(&self) -> &Block<'hir> {
let mut block = self;
while let Some(Expr { kind: ExprKind::Block(inner_block, _), .. }) = block.expr {
block = inner_block;
}
block
}
}
#[derive(Debug, HashStable_Generic)]
pub struct Pat<'hir> {
#[stable_hasher(ignore)]