-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE: print_if saw if with weird alternative, if-let.rs with -Zunpretty=hir,typed #82329
Labels
C-bug
Category: This is a bug.
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
matthiaskrgr
added
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Feb 20, 2021
@rustbot modify labels: requires-nightly |
rustbot
added
the
requires-nightly
This issue requires a nightly compiler in some way.
label
Feb 20, 2021
fanninpm
added a commit
to fanninpm/glacier
that referenced
this issue
Feb 20, 2021
Issue: rust-lang/rust#82329
rust/compiler/rustc_hir_pretty/src/lib.rs Lines 1118 to 1121 in d6eaea1
|
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 25, 2021
…nt, r=petrochenkov Handle pretty printing of `else if let` clauses without ICEing When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing. ```rust pub fn main() { if true { // 1 } else if let a = 1 { // 2 } else { // 3 } } ``` now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to: ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (if (true as bool) ({ // 1 } as ()) else {match (1 as i32) { a => { // 2 } _ => { // 3 } }} as ()) } as ()) ``` For comparison, this code gets HIR prettyprinted the same way before and after this change: ```rust pub fn main() { if let a = 1 { // 2 } else { // 3 } } ``` turns into ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (match (1 as i32) { a => { // 2 } _ => { // 3 } } as ()) } as ()) ``` This closes rust-lang#82329. It closes rust-lang#84434 as well, due to having the same root cause.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 25, 2021
…nt, r=petrochenkov Handle pretty printing of `else if let` clauses without ICEing When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing. ```rust pub fn main() { if true { // 1 } else if let a = 1 { // 2 } else { // 3 } } ``` now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to: ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (if (true as bool) ({ // 1 } as ()) else {match (1 as i32) { a => { // 2 } _ => { // 3 } }} as ()) } as ()) ``` For comparison, this code gets HIR prettyprinted the same way before and after this change: ```rust pub fn main() { if let a = 1 { // 2 } else { // 3 } } ``` turns into ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (match (1 as i32) { a => { // 2 } _ => { // 3 } } as ()) } as ()) ``` This closes rust-lang#82329. It closes rust-lang#84434 as well, due to having the same root cause.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 25, 2021
…nt, r=petrochenkov Handle pretty printing of `else if let` clauses without ICEing When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing. ```rust pub fn main() { if true { // 1 } else if let a = 1 { // 2 } else { // 3 } } ``` now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to: ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (if (true as bool) ({ // 1 } as ()) else {match (1 as i32) { a => { // 2 } _ => { // 3 } }} as ()) } as ()) ``` For comparison, this code gets HIR prettyprinted the same way before and after this change: ```rust pub fn main() { if let a = 1 { // 2 } else { // 3 } } ``` turns into ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (match (1 as i32) { a => { // 2 } _ => { // 3 } } as ()) } as ()) ``` This closes rust-lang#82329. It closes rust-lang#84434 as well, due to having the same root cause.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 25, 2021
…nt, r=petrochenkov Handle pretty printing of `else if let` clauses without ICEing When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing. ```rust pub fn main() { if true { // 1 } else if let a = 1 { // 2 } else { // 3 } } ``` now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to: ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (if (true as bool) ({ // 1 } as ()) else {match (1 as i32) { a => { // 2 } _ => { // 3 } }} as ()) } as ()) ``` For comparison, this code gets HIR prettyprinted the same way before and after this change: ```rust pub fn main() { if let a = 1 { // 2 } else { // 3 } } ``` turns into ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (match (1 as i32) { a => { // 2 } _ => { // 3 } } as ()) } as ()) ``` This closes rust-lang#82329. It closes rust-lang#84434 as well, due to having the same root cause.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
code reduced from
./src/test/ui/expr/if/if-let.rs
Meta
rustc --version --verbose
:Error output
rustc -Zunpretty=hir,typed ./src/test/ui/expr/if/if-let.rs
Backtrace
The text was updated successfully, but these errors were encountered: