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: Anonymous structs or unions cannot be type parameters #121161

Open
matthiaskrgr opened this issue Feb 15, 2024 · 1 comment · May be fixed by #121270
Open

ICE: Anonymous structs or unions cannot be type parameters #121161

matthiaskrgr opened this issue Feb 15, 2024 · 1 comment · May be fixed by #121270
Labels
C-bug Category: This is a bug. F-unnamed_fields `#![feature(unnamed_fields)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#[derive(Eq)]
#[repr(C)]
struct Bar {
    _: union {
        a: u8,
    },
}

original:

#![allow(incomplete_features)]
#![feature(unnamed_fields)]


#[derive(Eq)]
#[repr(C)]
struct Bar {
    _: union {
        a: u8,
    },
}

Version information

rustc 1.78.0-nightly (62fb0db9a 2024-02-15)
binary: rustc
commit-hash: 62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88
commit-date: 2024-02-15
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

thread 'rustc' panicked at compiler/rustc_builtin_macros/src/deriving/mod.rs:127:5:
Anonymous structs or unions cannot be type parameters
stack backtrace:
   0:     0x7f0f7ef8ce46 - std::backtrace_rs::backtrace::libunwind::trace::h53163824e7303228
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f0f7ef8ce46 - std::backtrace_rs::backtrace::trace_unsynchronized::hd2e35374a0eb2a80
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0f7ef8ce46 - std::sys_common::backtrace::_print_fmt::h22916166849b0f03
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f0f7ef8ce46 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2879f5e85b0fff5f
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0f7efdd46c - core::fmt::rt::Argument::fmt::h97dbf5cc12c408c7
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/core/src/fmt/rt.rs:142:9
   5:     0x7f0f7efdd46c - core::fmt::write::h778946ec939e8793
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f0f7ef8087f - std::io::Write::write_fmt::h5c63578d080db7f3
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/io/mod.rs:1854:15
   7:     0x7f0f7ef8cbf4 - std::sys_common::backtrace::_print::h0363c2f779186f3d
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0f7ef8cbf4 - std::sys_common::backtrace::print::h25462c423434b7b1
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0f7ef8f93b - std::panicking::default_hook::{{closure}}::h77a19008a0b97cd9
  10:     0x7f0f7ef8f689 - std::panicking::default_hook::hc24779731fadc8e1
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/panicking.rs:292:9
  11:     0x7f0f81e073dc - std[520fd08387c28b7f]::panicking::update_hook::<alloc[91e232cd38241d97]::boxed::Box<rustc_driver_impl[2702a2e4e48d8624]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f0f7ef900a0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd2fc103bd8349bfb
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/alloc/src/boxed.rs:2030:9
  13:     0x7f0f7ef900a0 - std::panicking::rust_panic_with_hook::h413c2c5969744120
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/panicking.rs:785:13
  14:     0x7f0f7ef8fda9 - std::panicking::begin_panic_handler::{{closure}}::h1a6d4d7a04fe1759
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/panicking.rs:651:13
  15:     0x7f0f7ef8d326 - std::sys_common::backtrace::__rust_end_short_backtrace::he707e3793b7e3c10
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f0f7ef8fb14 - rust_begin_unwind
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/panicking.rs:647:5
  17:     0x7f0f7efd9975 - core::panicking::panic_fmt::he521a95bbefc6993
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/core/src/panicking.rs:72:14
  18:     0x7f0f83bcfc1c - rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::assert_ty_bounds
  19:     0x7f0f83bce7ba - rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::eq::expand_deriving_eq::{closure#0}
  20:     0x7f0f838a3f8c - <rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::generic::TraitDef>::expand_struct_def
  21:     0x7f0f83bcaa51 - <rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::generic::TraitDef>::expand_ext
  22:     0x7f0f83cb1157 - rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::eq::expand_deriving_eq
  23:     0x7f0f838a1c92 - <rustc_builtin_macros[c3e0db7c51eb1b0b]::deriving::BuiltinDerive as rustc_expand[6d4d13d6cfdcaa99]::base::MultiItemModifier>::expand
  24:     0x7f0f8397ca07 - <rustc_expand[6d4d13d6cfdcaa99]::expand::MacroExpander>::fully_expand_fragment
  25:     0x7f0f8397a4b7 - <rustc_expand[6d4d13d6cfdcaa99]::expand::MacroExpander>::expand_crate
  26:     0x7f0f83edbd12 - rustc_interface[1a4459fc77d0f37b]::passes::resolver_for_lowering
  27:     0x7f0f83edb1e7 - rustc_query_impl[af4ac1f50c857cdc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af4ac1f50c857cdc]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[52734e1a61f3d33]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f0f83db790e - rustc_query_system[2a398b116e853220]::query::plumbing::try_execute_query::<rustc_query_impl[af4ac1f50c857cdc]::DynamicConfig<rustc_query_system[2a398b116e853220]::query::caches::SingleCache<rustc_middle[52734e1a61f3d33]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[af4ac1f50c857cdc]::plumbing::QueryCtxt, false>
  29:     0x7f0f83db708b - rustc_query_impl[af4ac1f50c857cdc]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f0f83d60954 - rustc_interface[1a4459fc77d0f37b]::interface::run_compiler::<core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>, rustc_driver_impl[2702a2e4e48d8624]::run_compiler::{closure#0}>::{closure#0}
  31:     0x7f0f83fcd686 - std[520fd08387c28b7f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1a4459fc77d0f37b]::util::run_in_thread_with_globals<rustc_interface[1a4459fc77d0f37b]::util::run_in_thread_pool_with_globals<rustc_interface[1a4459fc77d0f37b]::interface::run_compiler<core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>, rustc_driver_impl[2702a2e4e48d8624]::run_compiler::{closure#0}>::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>
  32:     0x7f0f83fcd4b2 - <<std[520fd08387c28b7f]::thread::Builder>::spawn_unchecked_<rustc_interface[1a4459fc77d0f37b]::util::run_in_thread_with_globals<rustc_interface[1a4459fc77d0f37b]::util::run_in_thread_pool_with_globals<rustc_interface[1a4459fc77d0f37b]::interface::run_compiler<core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>, rustc_driver_impl[2702a2e4e48d8624]::run_compiler::{closure#0}>::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f365f26a3905eec5]::result::Result<(), rustc_span[f91837123c8497a4]::ErrorGuaranteed>>::{closure#1} as core[f365f26a3905eec5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7f0f7ef991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcab8919dd66e63e8
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/alloc/src/boxed.rs:2016:9
  34:     0x7f0f7ef991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7fcf03bbae47bb99
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/alloc/src/boxed.rs:2016:9
  35:     0x7f0f7ef991e5 - std::sys::pal::unix::thread::Thread::new::thread_start::hdab999c156b6bbcb
                               at /rustc/62fb0db9a5a2a381f81ce0474c9bbd9ad385dd88/library/std/src/sys/pal/unix/thread.rs:108:17
  36:     0x7f0f7ed809eb - <unknown>
  37:     0x7f0f7ee047cc - <unknown>
  38:                0x0 - <unknown>

error: 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.78.0-nightly (62fb0db9a 2024-02-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Feb 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 15, 2024
@matthiaskrgr matthiaskrgr added the F-unnamed_fields `#![feature(unnamed_fields)]` label Feb 15, 2024
@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue requires-incomplete-features and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 15, 2024
@clubby789
Copy link
Contributor

Should be fixed by #121270

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
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. F-unnamed_fields `#![feature(unnamed_fields)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

4 participants