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: expected ADT to be an item #121446

Closed
matthiaskrgr opened this issue Feb 22, 2024 · 3 comments · Fixed by #121470
Closed

ICE: expected ADT to be an item #121446

matthiaskrgr opened this issue Feb 22, 2024 · 3 comments · Fixed by #121470
Assignees
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) ❄️ 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

matthiaskrgr commented Feb 22, 2024

snippet:

struct F {{}}

union H {{}}

enum K {
    M {
        _ : struct { field: u8 }, 
    }
}

Version information

rustc 1.78.0-nightly (f8131a48a 2024-02-21)
binary: rustc
commit-hash: f8131a48a46ac3bc8a3d0fe0477055b132cffdc3
commit-date: 2024-02-21
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

error: expected identifier, found `{`
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:1:11
  |
1 | struct F {{}}
  |        -  ^ expected identifier
  |        |
  |        while parsing this struct

error: expected identifier, found `{`
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:3:10
  |
3 | union H {{}}
  |       -  ^ expected identifier
  |       |
  |       while parsing this union

error: unions cannot have zero fields
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:3:1
  |
3 | union H {{}}
  | ^^^^^^^^^^^^

error: unnamed fields are not allowed outside of structs or unions
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:7:9
  |
7 |         _ : struct { field: u8 }, 
  |         -^^^^^^^^^^^^^^^^^^^^^^^
  |         |
  |         unnamed field declared here

error: anonymous structs are not allowed outside of unnamed struct or union fields
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:7:13
  |
7 |         _ : struct { field: u8 }, 
  |             ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here

error[E0658]: unnamed fields are not yet fully implemented
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:7:9
  |
7 |         _ : struct { field: u8 }, 
  |         ^
  |
  = 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
  = note: this compiler was built on 2024-02-21; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:7:13
  |
7 |         _ : struct { field: u8 }, 
  |             ^^^^^^^^^^^^^^^^^^^^
  |
  = 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
  = note: this compiler was built on 2024-02-21; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs:9:2
  |
9 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.4mjIprkNRiBM/rustc_testrunner_tmpdir_reporting.pVRtPSkGVlZP/mvce.rs`

error: internal compiler error: compiler/rustc_hir_analysis/src/collect.rs:1023:9: expected ADT to be an item

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0:     0x7f9c8038caf6 - std::backtrace_rs::backtrace::libunwind::trace::hbec2edc838b433e2
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f9c8038caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h88c30257ee0dd166
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9c8038caf6 - std::sys_common::backtrace::_print_fmt::h9176654d509e3088
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f9c8038caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h671feaee1776bf19
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9c803dda7c - core::fmt::rt::Argument::fmt::h59605c83ae32d935
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/rt.rs:142:9
   5:     0x7f9c803dda7c - core::fmt::write::hf7af8dfcfd20db5b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f9c803814bf - std::io::Write::write_fmt::h92a5dbf489025e71
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/io/mod.rs:1846:15
   7:     0x7f9c8038c8a4 - std::sys_common::backtrace::_print::h00080302d23998ae
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9c8038c8a4 - std::sys_common::backtrace::print::h6b23124445400245
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9c8038f5eb - std::panicking::default_hook::{{closure}}::hd67b2f9d36675a28
  10:     0x7f9c8038f339 - std::panicking::default_hook::h10a39ef11c714e42
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:292:9
  11:     0x7f9c8327a94c - std[5a8e7f94216a9138]::panicking::update_hook::<alloc[e14ab1f516d287ab]::boxed::Box<rustc_driver_impl[e279e4f1fedd9109]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f9c8038fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h37ba37dc48823c1d
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2030:9
  13:     0x7f9c8038fd50 - std::panicking::rust_panic_with_hook::he3e3bc7c345bf54b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:786:13
  14:     0x7f9c832a7524 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}
  15:     0x7f9c832a4176 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_end_short_backtrace::<std[5a8e7f94216a9138]::panicking::begin_panic<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9c8329f936 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>
  17:     0x7f9c81c17631 - <rustc_errors[34364e5c712fab73]::diagnostic::BugAbort as rustc_errors[34364e5c712fab73]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f9c8368300c - <rustc_errors[34364e5c712fab73]::DiagCtxt>::bug::<alloc[e14ab1f516d287ab]::string::String>
  19:     0x7f9c83727c7b - rustc_middle[446dd094ad85939e]::util::bug::opt_span_bug_fmt::<rustc_span[adb133ac03280fc1]::span_encoding::Span>::{closure#0}
  20:     0x7f9c8370bc3a - rustc_middle[446dd094ad85939e]::ty::context::tls::with_opt::<rustc_middle[446dd094ad85939e]::util::bug::opt_span_bug_fmt<rustc_span[adb133ac03280fc1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9c8370bab8 - rustc_middle[446dd094ad85939e]::ty::context::tls::with_context_opt::<rustc_middle[446dd094ad85939e]::ty::context::tls::with_opt<rustc_middle[446dd094ad85939e]::util::bug::opt_span_bug_fmt<rustc_span[adb133ac03280fc1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9c81b99af0 - rustc_middle[446dd094ad85939e]::util::bug::bug_fmt
  23:     0x7f9c84b917d0 - rustc_hir_analysis[71d4294717f7f2b7]::collect::adt_def
  24:     0x7f9c846746d5 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::adt_def::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f9c84674da1 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  26:     0x7f9c8467409e - rustc_query_impl[9d4c51777e2bb749]::query_impl::adt_def::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f9c848262dc - rustc_middle[446dd094ad85939e]::query::plumbing::query_get_at::<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>>
  28:     0x7f9c84b91826 - rustc_hir_analysis[71d4294717f7f2b7]::collect::adt_def
  29:     0x7f9c846746d5 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::adt_def::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f9c84674da1 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  31:     0x7f9c8467409e - rustc_query_impl[9d4c51777e2bb749]::query_impl::adt_def::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f9c848262dc - rustc_middle[446dd094ad85939e]::query::plumbing::query_get_at::<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>>
  33:     0x7f9c8481c6cb - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::ast_ty_to_ty_inner
  34:     0x7f9c828a5bcc - rustc_hir_analysis[71d4294717f7f2b7]::collect::type_of::type_of
  35:     0x7f9c84676126 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7f9c84674da1 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  37:     0x7f9c8467489d - rustc_query_impl[9d4c51777e2bb749]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f9c85062b87 - rustc_hir_analysis[71d4294717f7f2b7]::outlives::inferred_outlives_crate
  39:     0x7f9c850618a0 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::inferred_outlives_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7f9c8533338e - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  41:     0x7f9c85333e20 - rustc_query_impl[9d4c51777e2bb749]::query_impl::inferred_outlives_crate::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f9c84959d45 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::inferred_outlives_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 16usize]>>
  43:     0x7f9c84958983 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  44:     0x7f9c8495869e - rustc_query_impl[9d4c51777e2bb749]::query_impl::inferred_outlives_of::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f9c847015d5 - rustc_hir_analysis[71d4294717f7f2b7]::collect::predicates_defined_on
  46:     0x7f9c84701419 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::predicates_defined_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 24usize]>>
  47:     0x7f9c84700706 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  48:     0x7f9c84700220 - rustc_query_impl[9d4c51777e2bb749]::query_impl::predicates_defined_on::get_query_non_incr::__rust_end_short_backtrace
  49:     0x7f9c846ff20c - rustc_hir_analysis[71d4294717f7f2b7]::collect::predicates_of::predicates_of
  50:     0x7f9c846ff113 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 24usize]>>
  51:     0x7f9c846ff0f3 - <rustc_query_impl[9d4c51777e2bb749]::query_impl::predicates_of::dynamic_query::{closure#2} as core[85b4fd477ce5bb21]::ops::function::FnOnce<(rustc_middle[446dd094ad85939e]::ty::context::TyCtxt, rustc_span[adb133ac03280fc1]::def_id::DefId)>>::call_once
  52:     0x7f9c847006eb - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  53:     0x7f9c847002fe - rustc_query_impl[9d4c51777e2bb749]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7f9c849f3eb6 - <rustc_hir_analysis[71d4294717f7f2b7]::collect::CollectItemTypesVisitor as rustc_hir[170b9793d794ea06]::intravisit::Visitor>::visit_item
  55:     0x7f9c849f3176 - rustc_hir_analysis[71d4294717f7f2b7]::collect::collect_mod_item_types
  56:     0x7f9c849f3109 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 0usize]>>
  57:     0x7f9c8522b2ed - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefaultCache<rustc_span[adb133ac03280fc1]::def_id::LocalModDefId, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  58:     0x7f9c8522ae17 - rustc_query_impl[9d4c51777e2bb749]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  59:     0x7f9c84fad4e8 - rustc_hir_analysis[71d4294717f7f2b7]::check_crate
  60:     0x7f9c850a2dd3 - rustc_interface[7ca501d7f8f3a34f]::passes::analysis
  61:     0x7f9c850a2a29 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>
  62:     0x7f9c8533d4a5 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  63:     0x7f9c8533d209 - rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  64:     0x7f9c8534c719 - rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler::<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}
  65:     0x7f9c855be705 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>
  66:     0x7f9c855be532 - <<std[5a8e7f94216a9138]::thread::Builder>::spawn_unchecked_<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#1} as core[85b4fd477ce5bb21]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  67:     0x7f9c80399725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1bff3efb61c3fa6b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  68:     0x7f9c80399725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h83141cf549dced8a
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  69:     0x7f9c80399725 - std::sys::pal::unix::thread::Thread::new::thread_start::hbe9287fdd7c325bc
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys/pal/unix/thread.rs:108:17
  70:     0x7f9c801819eb - <unknown>
  71:     0x7f9c802057cc - <unknown>
  72:                0x0 - <unknown>

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 (f8131a48a 2024-02-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [adt_def] computing ADT definition for `K::M`
#1 [adt_def] computing ADT definition for `K::M::{anon_adt#0}`
#2 [type_of] computing type of `K::M::_`
#3 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
#4 [inferred_outlives_of] computing inferred outlives predicates of `F`
#5 [predicates_defined_on] computing predicates of `F`
#6 [predicates_of] computing predicates of `F`
#7 [collect_mod_item_types] collecting item types in top-level module
#8 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

@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 22, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 22, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: `expected ADT to be an item ICE: expected ADT to be an item Feb 22, 2024
@matthiaskrgr
Copy link
Member Author

#115367 cc @frank-king

@jieyouxu jieyouxu added F-unnamed_fields `#![feature(unnamed_fields)]` S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 22, 2024
@frank-king
Copy link
Contributor

Oh, seems that more checks are needed to prevent unnamed fields from occurring in enums.

@clubby789
Copy link
Contributor

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 23, 2024
…mease

Don't ICE on anonymous struct in enum variant

Fixes rust-lang#121446

Computing `adt_def` for the anon struct calls `adt_def` on the parent to find its repr. If the parent is a non-item (e.g. an enum variant) we should have already emitted at least one error, so we just use the repr of the anonymous struct to avoid an ICE.

cc `@frank-king`
@bors bors closed this as completed in 4d5c4e5 Feb 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2024
Rollup merge of rust-lang#121470 - clubby789:anon-struct-in-enum, r=fmease

Don't ICE on anonymous struct in enum variant

Fixes rust-lang#121446

Computing `adt_def` for the anon struct calls `adt_def` on the parent to find its repr. If the parent is a non-item (e.g. an enum variant) we should have already emitted at least one error, so we just use the repr of the anonymous struct to avoid an ICE.

cc ``@frank-king``
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) ❄️ 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.

5 participants