Skip to content

Incorrect HIR pretty printing for if / else #84493

Open
@tmiasko

Description

@tmiasko

For example:

pub fn f(x: usize) {
    if x == 1 {
    } else if x == 2 {
    } else if x == 3 {
    } else if x == 4 {
    } else {
    }
}

is formatted as follows (this is complete output):

$ rustc --crate-type=lib a.rs -Zunpretty=hir
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
pub fn f(x:
             usize) {
                        if x == 1
                           {
                           } else if x == 2
                            {
                            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions