Skip to content

ICE: feature-gate-unnamed_fields.rs: unwrap of None with -Zunpretty=expanded,hygiene  #85480

Closed
@matthiaskrgr

Description

@matthiaskrgr

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`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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