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: associated_item_def_ids: not impl or trait #127222

Closed
matthiaskrgr opened this issue Jul 1, 2024 · 1 comment · Fixed by #128174
Closed

ICE: associated_item_def_ids: not impl or trait #127222

matthiaskrgr opened this issue Jul 1, 2024 · 1 comment · Fixed by #128174
Labels
C-bug Category: This is a bug. 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:

#[marker]
trait Foo = PartialEq<i32> + Send;

Version information

rustc 1.81.0-nightly (221e2741c 2024-07-01)
binary: rustc
commit-hash: 221e2741c39515a5de6da42d8c76ee1e132c2c74
commit-date: 2024-07-01
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

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

Program output

error[E0658]: trait aliases are experimental
 --> /tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs:2:1
  |
2 | trait Foo = PartialEq<i32> + Send;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable
  = note: this compiler was built on 2024-07-01; consider upgrading it if it is out of date

error[E0658]: the `#[marker]` attribute is an experimental feature
 --> /tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs:1:1
  |
1 | #[marker]
  | ^^^^^^^^^
  |
  = note: see issue #29864 <https://github.com/rust-lang/rust/issues/29864> for more information
  = help: add `#![feature(marker_trait_attr)]` to the crate attributes to enable
  = note: this compiler was built on 2024-07-01; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs:2:35
  |
2 | trait Foo = PartialEq<i32> + Send;
  |                                   ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs`

error: attribute should be applied to a trait
 --> /tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs:1:1
  |
1 | #[marker]
  | ^^^^^^^^^
2 | trait Foo = PartialEq<i32> + Send;
  | ---------------------------------- not a trait

error: internal compiler error: compiler/rustc_ty_utils/src/assoc.rs:80:14: associated_item_def_ids: not impl or trait
 --> /tmp/icemaker_global_tempdir.BoZUjSTNMTmD/rustc_testrunner_tmpdir_reporting.QHjKfKkEvmKI/mvce.rs:2:1
  |
2 | trait Foo = PartialEq<i32> + Send;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_ty_utils/src/assoc.rs:80:14:
Box<dyn Any>
stack backtrace:
   0:     0x7d318d9723d5 - std::backtrace_rs::backtrace::libunwind::trace::hb712d1033083f19f
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7d318d9723d5 - std::backtrace_rs::backtrace::trace_unsynchronized::hcd45231d964c5f87
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7d318d9723d5 - std::sys::backtrace::_print_fmt::ha326387fd7186899
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/sys/backtrace.rs:68:5
   3:     0x7d318d9723d5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb0a71f126ecc5f94
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/sys/backtrace.rs:44:22
   4:     0x7d318d9c1adb - core::fmt::rt::Argument::fmt::hcb80cd58ae514c57
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/core/src/fmt/rt.rs:173:76
   5:     0x7d318d9c1adb - core::fmt::write::h24e86a79a1d9fd27
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/core/src/fmt/mod.rs:1174:21
   6:     0x7d318d966f7f - std::io::Write::write_fmt::h6f24f5499b917dd0
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/io/mod.rs:1835:15
   7:     0x7d318d9721ae - std::sys::backtrace::_print::hab3688cd990b4da1
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/sys/backtrace.rs:47:5
   8:     0x7d318d9721ae - std::sys::backtrace::print::hd7ca970b8f6f0d2a
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/sys/backtrace.rs:34:9
   9:     0x7d318d974af9 - std::panicking::default_hook::{{closure}}::hbcefa19962d38670
  10:     0x7d318d97489c - std::panicking::default_hook::ha30d3ad58a1508fe
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/panicking.rs:292:9
  11:     0x7d3189df21d9 - std[a32dded7438b921f]::panicking::update_hook::<alloc[e66b80bbeb26e33f]::boxed::Box<rustc_driver_impl[caf9fb610f137d76]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7d318d97541f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h62bf5bbfe5d978e7
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/alloc/src/boxed.rs:2078:9
  13:     0x7d318d97541f - std::panicking::rust_panic_with_hook::h27b2c56b49aaf9e9
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/panicking.rs:804:13
  14:     0x7d3189e2d0f1 - std[a32dded7438b921f]::panicking::begin_panic::<rustc_errors[b6aefecbd15b7a86]::ExplicitBug>::{closure#0}
  15:     0x7d3189e200a6 - std[a32dded7438b921f]::sys::backtrace::__rust_end_short_backtrace::<std[a32dded7438b921f]::panicking::begin_panic<rustc_errors[b6aefecbd15b7a86]::ExplicitBug>::{closure#0}, !>
  16:     0x7d3189e20056 - std[a32dded7438b921f]::panicking::begin_panic::<rustc_errors[b6aefecbd15b7a86]::ExplicitBug>
  17:     0x7d3189e36331 - <rustc_errors[b6aefecbd15b7a86]::diagnostic::BugAbort as rustc_errors[b6aefecbd15b7a86]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7d318ab7417d - <rustc_errors[b6aefecbd15b7a86]::DiagCtxtHandle>::span_bug::<rustc_span[5b114e5127e2dfa0]::span_encoding::Span, alloc[e66b80bbeb26e33f]::string::String>
  19:     0x7d318ab90538 - rustc_middle[9e476e531f4cdc39]::util::bug::opt_span_bug_fmt::<rustc_span[5b114e5127e2dfa0]::span_encoding::Span>::{closure#0}
  20:     0x7d318ab9060a - rustc_middle[9e476e531f4cdc39]::ty::context::tls::with_opt::<rustc_middle[9e476e531f4cdc39]::util::bug::opt_span_bug_fmt<rustc_span[5b114e5127e2dfa0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7d318ab8293b - rustc_middle[9e476e531f4cdc39]::ty::context::tls::with_context_opt::<rustc_middle[9e476e531f4cdc39]::ty::context::tls::with_opt<rustc_middle[9e476e531f4cdc39]::util::bug::opt_span_bug_fmt<rustc_span[5b114e5127e2dfa0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7d318ab7d8d7 - rustc_middle[9e476e531f4cdc39]::util::bug::span_bug_fmt::<rustc_span[5b114e5127e2dfa0]::span_encoding::Span>
  23:     0x7d318ca13e69 - rustc_ty_utils[6227c5ec0897bdc]::assoc::associated_item_def_ids.cold
  24:     0x7d318b945529 - rustc_query_impl[823e173f31dca1d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[823e173f31dca1d9]::query_impl::associated_item_def_ids::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 16usize]>>
  25:     0x7d318b9454d1 - <rustc_query_impl[823e173f31dca1d9]::query_impl::associated_item_def_ids::dynamic_query::{closure#2} as core[a1d5b26218b7595a]::ops::function::FnOnce<(rustc_middle[9e476e531f4cdc39]::ty::context::TyCtxt, rustc_span[5b114e5127e2dfa0]::def_id::DefId)>>::call_once
  26:     0x7d318b94affa - rustc_query_system[837d787005d5746e]::query::plumbing::try_execute_query::<rustc_query_impl[823e173f31dca1d9]::DynamicConfig<rustc_query_system[837d787005d5746e]::query::caches::DefIdCache<rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[823e173f31dca1d9]::plumbing::QueryCtxt, false>
  27:     0x7d318b94a9bf - rustc_query_impl[823e173f31dca1d9]::query_impl::associated_item_def_ids::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7d318ba79b17 - rustc_middle[9e476e531f4cdc39]::query::plumbing::query_get_at::<rustc_query_system[837d787005d5746e]::query::caches::DefIdCache<rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 16usize]>>>
  29:     0x7d318ba5b5a8 - rustc_hir_analysis[131fe9ac51ca670c]::check::wfcheck::check_trait
  30:     0x7d3188c11554 - rustc_hir_analysis[131fe9ac51ca670c]::check::wfcheck::check_well_formed
  31:     0x7d318ba40efd - rustc_query_impl[823e173f31dca1d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[823e173f31dca1d9]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7d318ba41175 - rustc_query_system[837d787005d5746e]::query::plumbing::try_execute_query::<rustc_query_impl[823e173f31dca1d9]::DynamicConfig<rustc_query_system[837d787005d5746e]::query::caches::VecCache<rustc_hir[ecde79dec73e1389]::hir_id::OwnerId, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[823e173f31dca1d9]::plumbing::QueryCtxt, false>
  33:     0x7d318ba40eda - rustc_query_impl[823e173f31dca1d9]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7d318ba41b89 - rustc_hir_analysis[131fe9ac51ca670c]::check::wfcheck::check_mod_type_wf
  35:     0x7d318ba419d9 - rustc_query_impl[823e173f31dca1d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[823e173f31dca1d9]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7d318c1288b8 - rustc_query_system[837d787005d5746e]::query::plumbing::try_execute_query::<rustc_query_impl[823e173f31dca1d9]::DynamicConfig<rustc_query_system[837d787005d5746e]::query::caches::DefaultCache<rustc_span[5b114e5127e2dfa0]::def_id::LocalModDefId, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[823e173f31dca1d9]::plumbing::QueryCtxt, false>
  37:     0x7d318c128667 - rustc_query_impl[823e173f31dca1d9]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7d318b6fd1c1 - rustc_hir_analysis[131fe9ac51ca670c]::check_crate
  39:     0x7d318b6f3215 - rustc_interface[b2c362fcb0f0a28c]::passes::analysis
  40:     0x7d318b6f2ddb - rustc_query_impl[823e173f31dca1d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[823e173f31dca1d9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>
  41:     0x7d318c2dcce5 - rustc_query_system[837d787005d5746e]::query::plumbing::try_execute_query::<rustc_query_impl[823e173f31dca1d9]::DynamicConfig<rustc_query_system[837d787005d5746e]::query::caches::SingleCache<rustc_middle[9e476e531f4cdc39]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[823e173f31dca1d9]::plumbing::QueryCtxt, false>
  42:     0x7d318c2dca4f - rustc_query_impl[823e173f31dca1d9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7d318c21c407 - rustc_interface[b2c362fcb0f0a28c]::interface::run_compiler::<core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>, rustc_driver_impl[caf9fb610f137d76]::run_compiler::{closure#0}>::{closure#1}
  44:     0x7d318c19c689 - std[a32dded7438b921f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b2c362fcb0f0a28c]::util::run_in_thread_with_globals<rustc_interface[b2c362fcb0f0a28c]::util::run_in_thread_pool_with_globals<rustc_interface[b2c362fcb0f0a28c]::interface::run_compiler<core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>, rustc_driver_impl[caf9fb610f137d76]::run_compiler::{closure#0}>::{closure#1}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>::{closure#0}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>
  45:     0x7d318c19c43a - <<std[a32dded7438b921f]::thread::Builder>::spawn_unchecked_<rustc_interface[b2c362fcb0f0a28c]::util::run_in_thread_with_globals<rustc_interface[b2c362fcb0f0a28c]::util::run_in_thread_pool_with_globals<rustc_interface[b2c362fcb0f0a28c]::interface::run_compiler<core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>, rustc_driver_impl[caf9fb610f137d76]::run_compiler::{closure#0}>::{closure#1}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>::{closure#0}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a1d5b26218b7595a]::result::Result<(), rustc_span[5b114e5127e2dfa0]::ErrorGuaranteed>>::{closure#2} as core[a1d5b26218b7595a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7d318d97f27b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8a74f28960a176f3
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/alloc/src/boxed.rs:2064:9
  47:     0x7d318d97f27b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3f01a028499c33ae
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/alloc/src/boxed.rs:2064:9
  48:     0x7d318d97f27b - std::sys::pal::unix::thread::Thread::new::thread_start::h256c3a78891e662c
                               at /rustc/221e2741c39515a5de6da42d8c76ee1e132c2c74/library/std/src/sys/pal/unix/thread.rs:108:17
  49:     0x7d31868a6ded - <unknown>
  50:     0x7d318692a0dc - <unknown>
  51:                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: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (221e2741c 2024-07-01) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [associated_item_def_ids] collecting associated items or fields of `Foo`
#1 [check_well_formed] checking that `Foo` is well-formed
end of query stack
error: aborting due to 5 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 Jul 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 1, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-02-08
commit[0] 2023-02-06: Auto merge of #107738 - matthiaskrgr:rollup-o18lzi8, r=matthiaskrgr
commit[1] 2023-02-07: Auto merge of #107693 - petrochenkov:metable, r=oli-obk
commit[2] 2023-02-07: Auto merge of #106180 - RalfJung:dereferenceable-generators, r=nbdd0121
commit[3] 2023-02-07: Auto merge of #107704 - jyn514:tidy-ci, r=Mark-Simulacrum
commit[4] 2023-02-07: Auto merge of #107671 - CastilloDel:master, r=estebank
commit[5] 2023-02-07: Auto merge of #107767 - matthiaskrgr:rollup-9m1qfso, r=matthiaskrgr

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jul 5, 2024
@bors bors closed this as completed in 5551f54 Jul 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 29, 2024
Rollup merge of rust-lang#128174 - compiler-errors:trait-alias-marker, r=oli-obk

Don't record trait aliases as marker traits

Don't record `#[marker]` on trait aliases, since we use that to check for the (non-presence of) associated types and other things which don't make sense of trait aliases. We already enforce this attr is only applied to a trait.

Also do the same for `#[const_trait]`, which we also enforce is only applied to a trait. This is a drive-by change, but also worthwhile just in case.

Fixes rust-lang#127222
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 30, 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. 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.

3 participants