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: def_collector: no entry found for key #117942

Closed
matthiaskrgr opened this issue Nov 15, 2023 · 2 comments · Fixed by #131045
Closed

ICE: def_collector: no entry found for key #117942

matthiaskrgr opened this issue Nov 15, 2023 · 2 comments · Fixed by #131045
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-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

struct Foo {
    _: union  {
    #[rustfmt::skip]
    f: String
    },
}

Version information

rustc 1.76.0-nightly (8d57ad1ad 2023-11-14)
binary: rustc
commit-hash: 8d57ad1adeb66bc183ee8171b57839656896b7d5
commit-date: 2023-11-14
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.4

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

Program output

thread 'rustc' panicked at compiler/rustc_resolve/src/def_collector.rs:61:56:
no entry found for key
stack backtrace:
   0:     0x7f73f999289c - std::backtrace_rs::backtrace::libunwind::trace::h31c51c172b60df1f
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f73f999289c - std::backtrace_rs::backtrace::trace_unsynchronized::he3f7436095f6c268
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f73f999289c - std::sys_common::backtrace::_print_fmt::h9ecb16af589a0fbb
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f73f999289c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h879345ff56d51582
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f73f99e58a0 - core::fmt::rt::Argument::fmt::hf48167ed22d6afa3
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/fmt/rt.rs:142:9
   5:     0x7f73f99e58a0 - core::fmt::write::haf17f643ce868e2d
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f73f99867bf - std::io::Write::write_fmt::hea57ebf7fed914ac
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/io/mod.rs:1762:15
   7:     0x7f73f9992684 - std::sys_common::backtrace::_print::hd6cb4ba72955bb4b
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f73f9992684 - std::sys_common::backtrace::print::h4634a5d49ae4175c
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f73f9995317 - std::panicking::default_hook::{{closure}}::h5b815abc8880c45c
  10:     0x7f73f999507f - std::panicking::default_hook::h9fc3db6ef2ff0764
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/panicking.rs:292:9
  11:     0x7f73f66e6c00 - std[4c4ee8ebf0986186]::panicking::update_hook::<alloc[b75c4bd6c90be06c]::boxed::Box<rustc_driver_impl[f2304ccc53dc8b38]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f73f9995a58 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0b9450117303d0ca
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/alloc/src/boxed.rs:2021:9
  13:     0x7f73f9995a58 - std::panicking::rust_panic_with_hook::h628d6ded0472c14b
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/panicking.rs:783:13
  14:     0x7f73f99957ae - std::panicking::begin_panic_handler::{{closure}}::h66949746e4f54942
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/panicking.rs:657:13
  15:     0x7f73f9992d66 - std::sys_common::backtrace::__rust_end_short_backtrace::h44ec451ae0e12e00
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f73f9995512 - rust_begin_unwind
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/panicking.rs:645:5
  17:     0x7f73f99e1f85 - core::panicking::panic_fmt::h5b80d414fa976bfc
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/panicking.rs:72:14
  18:     0x7f73f99e1d33 - core::panicking::panic_display::ha511c0ba4b1cda64
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/panicking.rs:178:5
  19:     0x7f73f99e1d33 - core::panicking::panic_str::h62d9420133b896b0
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/panicking.rs:152:5
  20:     0x7f73f99e1d33 - core::option::expect_failed::he876ec0710942e37
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/core/src/option.rs:1980:5
  21:     0x7f73f7a82d82 - <rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector>::collect_field
  22:     0x7f73f7a83352 - rustc_ast[e37068419772bcd3]::visit::walk_ty::<rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector>
  23:     0x7f73f7a829ed - <rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector>::collect_field
  24:     0x7f73f7ebd434 - rustc_ast[e37068419772bcd3]::visit::walk_item::<rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector>
  25:     0x7f73f7ebca96 - <rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector as rustc_ast[e37068419772bcd3]::visit::Visitor>::visit_item
  26:     0x7f73f7ebc99e - <rustc_resolve[6a65679376ac23a9]::def_collector::DefCollector as rustc_ast[e37068419772bcd3]::visit::Visitor>::visit_crate
  27:     0x7f73f7ebb07a - <rustc_resolve[6a65679376ac23a9]::Resolver as rustc_expand[12c5afb661d7ae19]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  28:     0x7f73f7eb75c6 - <rustc_expand[12c5afb661d7ae19]::expand::MacroExpander>::collect_invocations
  29:     0x7f73f83b3d88 - <rustc_expand[12c5afb661d7ae19]::expand::MacroExpander>::fully_expand_fragment
  30:     0x7f73f83b2c2a - <rustc_expand[12c5afb661d7ae19]::expand::MacroExpander>::expand_crate
  31:     0x7f73f8a417f8 - rustc_interface[ed36f66d4dd25afa]::passes::resolver_for_lowering
  32:     0x7f73f8a40bab - rustc_query_impl[c23592c0c653c664]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c23592c0c653c664]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[69724fdf0a9160]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7f73f86ffbb2 - rustc_query_system[d7212ac5995c6075]::query::plumbing::try_execute_query::<rustc_query_impl[c23592c0c653c664]::DynamicConfig<rustc_query_system[d7212ac5995c6075]::query::caches::SingleCache<rustc_middle[69724fdf0a9160]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c23592c0c653c664]::plumbing::QueryCtxt, false>
  34:     0x7f73f8700609 - rustc_query_impl[c23592c0c653c664]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f73f899e127 - rustc_interface[ed36f66d4dd25afa]::interface::run_compiler::<core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>, rustc_driver_impl[f2304ccc53dc8b38]::run_compiler::{closure#1}>::{closure#0}
  36:     0x7f73f89a5619 - std[4c4ee8ebf0986186]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ed36f66d4dd25afa]::util::run_in_thread_with_globals<rustc_interface[ed36f66d4dd25afa]::util::run_in_thread_pool_with_globals<rustc_interface[ed36f66d4dd25afa]::interface::run_compiler<core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>, rustc_driver_impl[f2304ccc53dc8b38]::run_compiler::{closure#1}>::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>
  37:     0x7f73f89a5443 - <<std[4c4ee8ebf0986186]::thread::Builder>::spawn_unchecked_<rustc_interface[ed36f66d4dd25afa]::util::run_in_thread_with_globals<rustc_interface[ed36f66d4dd25afa]::util::run_in_thread_pool_with_globals<rustc_interface[ed36f66d4dd25afa]::interface::run_compiler<core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>, rustc_driver_impl[f2304ccc53dc8b38]::run_compiler::{closure#1}>::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[41362f4be93c713f]::result::Result<(), rustc_span[e48a8ae9d6fa383d]::ErrorGuaranteed>>::{closure#1} as core[41362f4be93c713f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f73f999f915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9a9c2927adaa2592
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/alloc/src/boxed.rs:2007:9
  39:     0x7f73f999f915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3d4b40c6e2a97503
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/alloc/src/boxed.rs:2007:9
  40:     0x7f73f999f915 - std::sys::unix::thread::Thread::new::thread_start::hab0d4f9d960c1874
                               at /rustc/8d57ad1adeb66bc183ee8171b57839656896b7d5/library/std/src/sys/unix/thread.rs:108:17
  41:     0x7f73f38759eb - <unknown>
  42:     0x7f73f38f97cc - <unknown>
  43:                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.76.0-nightly (8d57ad1ad 2023-11-14) 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 Nov 15, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-08-25

Regression in 18be272

#115131 ping @frank-king

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2023
@frank-king
Copy link
Contributor

Got it. It is now being rewritten in #115732, I will add this fmt test.

frank-king added a commit to frank-king/rust that referenced this issue Jan 6, 2024
frank-king added a commit to frank-king/rust that referenced this issue Jan 7, 2024
frank-king added a commit to frank-king/rust that referenced this issue Jan 18, 2024
frank-king added a commit to frank-king/rust that referenced this issue Jan 29, 2024
@fmease fmease added the F-unnamed_fields `#![feature(unnamed_fields)]` label Feb 9, 2024
frank-king added a commit to frank-king/rust that referenced this issue Feb 12, 2024
frank-king added a commit to frank-king/rust that referenced this issue Feb 12, 2024
@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
calebcartwright pushed a commit to calebcartwright/rust that referenced this issue Jun 22, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 11, 2024
…s, r=wesleywiser

Retire the `unnamed_fields` feature for now

`#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature.

However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly.

Fixes rust-lang#117942
Fixes rust-lang#121161
Fixes rust-lang#121263
Fixes rust-lang#121299
Fixes rust-lang#121722
Fixes rust-lang#121799
Fixes rust-lang#126969
Fixes rust-lang#131041

Tracking:
* rust-lang#49804

[^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields
[^2]: rust-lang#49804 (comment)
@bors bors closed this as completed in f496659 Oct 11, 2024
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 18, 2024
…s, r=wesleywiser

Retire the `unnamed_fields` feature for now

`#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature.

However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly.

Fixes rust-lang#117942
Fixes rust-lang#121161
Fixes rust-lang#121263
Fixes rust-lang#121299
Fixes rust-lang#121722
Fixes rust-lang#121799
Fixes rust-lang#126969
Fixes rust-lang#131041

Tracking:
* rust-lang#49804

[^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields
[^2]: rust-lang#49804 (comment)
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-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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