In the AST the "then" block is represented as a `Block`. In HIR the "then" block is represented as an `Expr` that happens to always be. `ExprKind::Block`. By deconstructing the `ExprKind::Block` to extract the block within, things print properly. For `issue-82392.rs`, note that we no longer print a type after the "then" block. This is good, it now matches how we don't print a type for the "else" block. (Well, we do print a type after the "else" block, but it's for the whole if/else.) Also tighten up some of the pattern matching -- these block expressions within if/else will never have labels.
17 lines
438 B
Text
17 lines
438 B
Text
#[prelude_import]
|
|
use ::std::prelude::rust_2015::*;
|
|
#[macro_use]
|
|
extern crate std;
|
|
// https://github.com/rust-lang/rust/issues/82329
|
|
//@ compile-flags: -Zunpretty=hir,typed
|
|
//@ check-pass
|
|
//@ edition:2015
|
|
|
|
fn main() ({
|
|
(if (true as bool) {
|
|
} else if (let Some(a) =
|
|
((Some as
|
|
fn(i32) -> Option<i32> {Option::<i32>::Some})((3 as i32)) as
|
|
Option<i32>) as bool) {
|
|
} as ())
|
|
} as ())
|