Skip to content
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: feature-gate-unnamed_fields.rs: unwrap of None with -Zunpretty=expanded,hygiene #85480

Closed
matthiaskrgr opened this issue May 19, 2021 · 2 comments · Fixed by #85515
Closed
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) 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.

Comments

@matthiaskrgr
Copy link
Member

Code

reduced from ./src/test/ui/feature-gates/feature-gate-unnamed_fields.rs

struct Foo {
    _: union { 
    }
}


fn main(){}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (4e3e6db01 2021-05-18)
binary: rustc
commit-hash: 4e3e6db011c5b482d2bef8ba02274657f93b5e0d
commit-date: 2021-05-18
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

rustc ./src/test/ui/feature-gates/feature-gate-unnamed_fields.rs -Zunpretty=expanded,hygiene

error[E0658]: unnamed fields are not yet fully implemented
 --> ./src/test/ui/feature-gates/feature-gate-unnamed_fields.rs:2:5
  |
2 |     _: union {
  |     ^
  |
  = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
  = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable

error[E0658]: unnamed fields are not yet fully implemented
 --> ./src/test/ui/feature-gates/feature-gate-unnamed_fields.rs:2:8
  |
2 |       _: union {
  |  ________^
3 | |     }
  | |_____^
  |
  = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
  = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable

error: anonymous unions are unimplemented
 --> ./src/test/ui/feature-gates/feature-gate-unnamed_fields.rs:2:8
  |
2 |       _: union {
  |  ________^
3 | |     }
  | |_____^

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_ast_pretty/src/pp.rs:507:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (4e3e6db01 2021-05-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=expanded,hygiene

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.
Backtrace


thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_ast_pretty/src/pp.rs:507:32
stack backtrace:
   0:     0x7f0dcdcae0b0 - std::backtrace_rs::backtrace::libunwind::trace::h1037ca7e6eeef65c
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f0dcdcae0b0 - std::backtrace_rs::backtrace::trace_unsynchronized::haaefac1bc3669450
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0dcdcae0b0 - std::sys_common::backtrace::_print_fmt::h863a6f5e6d995885
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f0dcdcae0b0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h767e17e1aa7df6a8
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f0dcdd1b47d - core::fmt::write::h7aa6cd0067dca82a
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/fmt/mod.rs:1094:17
   5:     0x7f0dcdc9f935 - std::io::Write::write_fmt::h4c802b6f761026c1
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/io/mod.rs:1584:15
   6:     0x7f0dcdcb1e7b - std::sys_common::backtrace::_print::h2769edb26a7eb606
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f0dcdcb1e7b - std::sys_common::backtrace::print::ha71f3549862b4cb6
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f0dcdcb1e7b - std::panicking::default_hook::{{closure}}::h95488a3bade217f6
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:208:50
   9:     0x7f0dcdcb1951 - std::panicking::default_hook::h290aa602c0fb11df
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:225:9
  10:     0x7f0dce47c35d - rustc_driver::report_ice::hd575aa67be3288bc
  11:     0x7f0dcdcb25f5 - std::panicking::rust_panic_with_hook::hf32c4fa635e215f2
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:629:17
  12:     0x7f0dcdcb2137 - std::panicking::begin_panic_handler::{{closure}}::h95197ccd88846f7a
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:517:13
  13:     0x7f0dcdcae58c - std::sys_common::backtrace::__rust_end_short_backtrace::h7641df9566f7b7d0
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f0dcdcb20c9 - rust_begin_unwind
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:515:5
  15:     0x7f0dcdc7ce41 - core::panicking::panic_fmt::hbe99dddd3092ba3c
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/panicking.rs:92:14
  16:     0x7f0dcdc7cd8d - core::panicking::panic::h3de4db67bd397eb3
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/panicking.rs:50:5
  17:     0x7f0dcff4554c - rustc_ast_pretty::pp::Printer::end::h3819f4d47ee568a3
  18:     0x7f0dd08b8ea7 - rustc_ast_pretty::pprust::state::State::print_type::h571840529fd0eb91
  19:     0x7f0dcf3c6b12 - rustc_ast_pretty::pprust::state::State::print_record_struct_body::h453d27d1610012a7
  20:     0x7f0dcf3c5a69 - rustc_ast_pretty::pprust::state::State::print_item::ha860ca047fccaf87
  21:     0x7f0dcf3c0f5a - rustc_ast_pretty::pprust::state::print_crate::h0b939fde4c9e1af8
  22:     0x7f0dce481a77 - rustc_driver::pretty::print_after_hir_lowering::hef45df26339fcb46
  23:     0x7f0dcff98aae - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h460c5796e582efcd
  24:     0x7f0dcff8715c - rustc_span::with_source_map::h5b1831a7c490d4e1
  25:     0x7f0dcff99c7a - rustc_interface::interface::create_compiler_and_run::h1a6787c1265e84cb
  26:     0x7f0dcff8a2d9 - scoped_tls::ScopedKey<T>::set::ha23e3ea5e8121f7a
  27:     0x7f0dcff99fdb - std::sys_common::backtrace::__rust_begin_short_backtrace::h547c89617ab570d2
  28:     0x7f0dcff81f85 - core::ops::function::FnOnce::call_once{{vtable.shim}}::he4ef2418a213a503
  29:     0x7f0dcdcbe627 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h902e2cf6655e1b0c
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/alloc/src/boxed.rs:1575:9
  30:     0x7f0dcdcbe627 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h893a5452154309d1
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/alloc/src/boxed.rs:1575:9
  31:     0x7f0dcdcbe627 - std::sys::unix::thread::Thread::new::thread_start::hdedcb57c96ab37cd
                               at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/sys/unix/thread.rs:71:17
  32:     0x7f0dcdbcc299 - start_thread
  33:     0x7f0dcdae1053 - clone
  34:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (4e3e6db01 2021-05-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=expanded,hygiene

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.

@matthiaskrgr 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 May 19, 2021
@jonas-schievink jonas-schievink added the A-pretty Area: Pretty printing (including `-Z unpretty`) label May 19, 2021
@matthiaskrgr
Copy link
Member Author

searched nightlies: from nightly-2021-04-01 to nightly-2021-05-18
regressed nightly: nightly-2021-05-18
searched commits: from fe72845 to 3e99439
regressed commit: 9964284

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --test-dir=/home/matthias/vcs/github/rust_bisect/foo --start=2021-04-01 --end=2021-05-18

@Urgau
Copy link
Member

Urgau commented May 20, 2021

cc @jedel1043 who wrote the code that regressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants