Skip to content

ice: unknown alias DefKind: AnonConst #116710

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
matthiaskrgr opened this issue Oct 13, 2023 · 2 comments · Fixed by #123579
Closed

ice: unknown alias DefKind: AnonConst #116710

matthiaskrgr opened this issue Oct 13, 2023 · 2 comments · Fixed by #123579
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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.

Comments

@matthiaskrgr
Copy link
Member

File: /tmp/F/1a095d17cdade179e5022f95e67027ae90704896.rs

auto-reduced (treereduce-rust):

#![feature(generic_const_exprs)]

struct Uwu<const N: u32 = 1, const M: u32 = u8>;

trait Trait {}
impl<const N: u32> Trait for Uwu<N> {}

impl<const N: u32> Trait for Uwu<N> {}

original:

#![feature(generic_const_exprs)]

struct Uwu<const N: u32 = 1, const M: u32 = u8>;

trait Trait {}
impl<const N: u32> Trait for Uwu<N> {}

impl<const N: u32> Trait for Uwu<N> {}

Version information

rustc 1.75.0-nightly (57ef88985 2023-10-13)
binary: rustc
commit-hash: 57ef8898520f7ff2c60341636bb86d94cb550e79
commit-date: 2023-10-13
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Ztrait-solver=next-coherence

Program output

error[E0423]: expected value, found builtin type `u8`
 --> /tmp/F/1a095d17cdade179e5022f95e67027ae90704896.rs:3:45
  |
3 | struct Uwu<const N: u32 = 1, const M: u32 = u8>;
  |                                             ^^ not a value

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/F/1a095d17cdade179e5022f95e67027ae90704896.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `1a095d17cdade179e5022f95e67027ae90704896`
 --> /tmp/F/1a095d17cdade179e5022f95e67027ae90704896.rs:8:39
  |
8 | impl<const N: u32> Trait for Uwu<N> {}
  |                                       ^ consider adding a `main` function to `/tmp/F/1a095d17cdade179e5022f95e67027ae90704896.rs`

error: internal compiler error: /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/compiler/rustc_middle/src/ty/relate.rs:289:24: unknown alias DefKind: AnonConst

thread 'rustc' panicked at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/compiler/rustc_errors/src/lib.rs:1658:9:
Box<dyn Any>
stack backtrace:
   0:     0x7f7e3f1628fc - std::backtrace_rs::backtrace::libunwind::trace::h03c0bf785ff8ac95
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7e3f1628fc - std::backtrace_rs::backtrace::trace_unsynchronized::heb554a194a8b8d76
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7e3f1628fc - std::sys_common::backtrace::_print_fmt::h5104548cf2f1d04d
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f7e3f1628fc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h60a89bd281db8532
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7e3f1ca350 - core::fmt::rt::Argument::fmt::h3f967ff7ed1eb864
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/core/src/fmt/rt.rs:142:9
   5:     0x7f7e3f1ca350 - core::fmt::write::h6c7eacf90d438ccc
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/core/src/fmt/mod.rs:1117:17
   6:     0x7f7e3f155c4f - std::io::Write::write_fmt::heed557ad0e7e227d
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/io/mod.rs:1762:15
   7:     0x7f7e3f1626e4 - std::sys_common::backtrace::_print::hc14194a28bba6478
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f7e3f1626e4 - std::sys_common::backtrace::print::h49644fe6309a893a
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f7e3f1654f7 - std::panicking::default_hook::{{closure}}::h2aa5ccff7297f9c8
  10:     0x7f7e3f16523a - std::panicking::default_hook::h9e4bff1aa2bdf161
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/panicking.rs:292:9
  11:     0x7f7e41d18daa - std[5f80c380de201c9c]::panicking::update_hook::<alloc[9cbc8cef37f5f9a9]::boxed::Box<rustc_driver_impl[3ff10296a9c85239]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f7e3f165c98 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h372bad5385f8c0c5
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/alloc/src/boxed.rs:2021:9
  13:     0x7f7e3f165c98 - std::panicking::rust_panic_with_hook::h6c6741452089fc1b
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/panicking.rs:735:13
  14:     0x7f7e420c9f34 - std[5f80c380de201c9c]::panicking::begin_panic::<rustc_errors[204736555763a020]::ExplicitBug>::{closure#0}
  15:     0x7f7e420c0f16 - std[5f80c380de201c9c]::sys_common::backtrace::__rust_end_short_backtrace::<std[5f80c380de201c9c]::panicking::begin_panic<rustc_errors[204736555763a020]::ExplicitBug>::{closure#0}, !>
  16:     0x7f7e420bb8c6 - std[5f80c380de201c9c]::panicking::begin_panic::<rustc_errors[204736555763a020]::ExplicitBug>
  17:     0x7f7e420a4584 - <rustc_errors[204736555763a020]::HandlerInner>::bug::<alloc[9cbc8cef37f5f9a9]::string::String>
  18:     0x7f7e420a4344 - <rustc_errors[204736555763a020]::Handler>::bug::<alloc[9cbc8cef37f5f9a9]::string::String>
  19:     0x7f7e42145abd - rustc_middle[48fc6e82f368dfd0]::util::bug::opt_span_bug_fmt::<rustc_span[3385b0a88a85fcb6]::span_encoding::Span>::{closure#0}
  20:     0x7f7e4212c37a - rustc_middle[48fc6e82f368dfd0]::ty::context::tls::with_opt::<rustc_middle[48fc6e82f368dfd0]::util::bug::opt_span_bug_fmt<rustc_span[3385b0a88a85fcb6]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f7e4212c238 - rustc_middle[48fc6e82f368dfd0]::ty::context::tls::with_context_opt::<rustc_middle[48fc6e82f368dfd0]::ty::context::tls::with_opt<rustc_middle[48fc6e82f368dfd0]::util::bug::opt_span_bug_fmt<rustc_span[3385b0a88a85fcb6]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f7e401ba6a0 - rustc_middle[48fc6e82f368dfd0]::util::bug::bug_fmt
  23:     0x7f7e40889ede - <rustc_infer[5b2553af17e3ada]::infer::at::At>::eq::<rustc_middle[48fc6e82f368dfd0]::ty::sty::AliasTy>
  24:     0x7f7e426e24fb - <rustc_trait_selection[5d100321d2a01e19]::solve::eval_ctxt::EvalCtxt>::eq::<rustc_middle[48fc6e82f368dfd0]::ty::sty::AliasTy>
  25:     0x7f7e4268614a - <rustc_trait_selection[5d100321d2a01e19]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[5d100321d2a01e19]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
  26:     0x7f7e42684331 - <rustc_trait_selection[5d100321d2a01e19]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[5d100321d2a01e19]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
  27:     0x7f7e4267a808 - <rustc_trait_selection[5d100321d2a01e19]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  28:     0x7f7e426e0ec6 - <rustc_infer[5b2553af17e3ada]::infer::InferCtxt as rustc_trait_selection[5d100321d2a01e19]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal
  29:     0x7f7e4267bf9f - <rustc_trait_selection[5d100321d2a01e19]::solve::fulfill::FulfillmentCtxt as rustc_infer[5b2553af17e3ada]::traits::engine::TraitEngine>::select_where_possible
  30:     0x7f7e405736eb - <rustc_infer[5b2553af17e3ada]::infer::InferCtxt as rustc_trait_selection[5d100321d2a01e19]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  31:     0x7f7e413765b5 - rustc_trait_selection[5d100321d2a01e19]::traits::coherence::overlap
  32:     0x7f7e413738cf - <rustc_middle[48fc6e82f368dfd0]::traits::specialization_graph::Children as rustc_trait_selection[5d100321d2a01e19]::traits::specialize::specialization_graph::ChildrenExt>::insert
  33:     0x7f7e41371a49 - <rustc_middle[48fc6e82f368dfd0]::traits::specialization_graph::Graph as rustc_trait_selection[5d100321d2a01e19]::traits::specialize::specialization_graph::GraphExt>::insert
  34:     0x7f7e4136f8aa - rustc_trait_selection[5d100321d2a01e19]::traits::specialize::specialization_graph_provider
  35:     0x7f7e412871ea - rustc_query_impl[d93ff4b57be0a3f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d93ff4b57be0a3f9]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7f7e403cf2d1 - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::<rustc_query_impl[d93ff4b57be0a3f9]::DynamicConfig<rustc_query_system[bf593801cb8c9f4a]::query::caches::DefaultCache<rustc_span[3385b0a88a85fcb6]::def_id::DefId, rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d93ff4b57be0a3f9]::plumbing::QueryCtxt, false>
  37:     0x7f7e417e4f82 - rustc_query_impl[d93ff4b57be0a3f9]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f7e4142df6e - rustc_hir_analysis[bb181583de2bc3da]::coherence::coherent_trait
  39:     0x7f7e4145fd07 - rustc_query_impl[d93ff4b57be0a3f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d93ff4b57be0a3f9]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 0usize]>>
  40:     0x7f7e4145fa6b - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::<rustc_query_impl[d93ff4b57be0a3f9]::DynamicConfig<rustc_query_system[bf593801cb8c9f4a]::query::caches::DefaultCache<rustc_span[3385b0a88a85fcb6]::def_id::DefId, rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d93ff4b57be0a3f9]::plumbing::QueryCtxt, false>
  41:     0x7f7e4145f7b1 - rustc_query_impl[d93ff4b57be0a3f9]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f7e413874fe - rustc_hir_analysis[bb181583de2bc3da]::check_crate
  43:     0x7f7e4137d43a - rustc_interface[d1c057f52199548c]::passes::analysis
  44:     0x7f7e415cb807 - rustc_query_impl[d93ff4b57be0a3f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d93ff4b57be0a3f9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7f7e415cb3f6 - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::<rustc_query_impl[d93ff4b57be0a3f9]::DynamicConfig<rustc_query_system[bf593801cb8c9f4a]::query::caches::SingleCache<rustc_middle[48fc6e82f368dfd0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d93ff4b57be0a3f9]::plumbing::QueryCtxt, false>
  46:     0x7f7e415cb1ad - rustc_query_impl[d93ff4b57be0a3f9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7f7e414e7500 - std[5f80c380de201c9c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d1c057f52199548c]::util::run_in_thread_with_globals<rustc_interface[d1c057f52199548c]::interface::run_compiler<core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>, rustc_driver_impl[3ff10296a9c85239]::run_compiler::{closure#1}>::{closure#0}, core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>>
  48:     0x7f7e414e67d3 - <<std[5f80c380de201c9c]::thread::Builder>::spawn_unchecked_<rustc_interface[d1c057f52199548c]::util::run_in_thread_with_globals<rustc_interface[d1c057f52199548c]::interface::run_compiler<core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>, rustc_driver_impl[3ff10296a9c85239]::run_compiler::{closure#1}>::{closure#0}, core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ecddd5f6ab0df47]::result::Result<(), rustc_span[3385b0a88a85fcb6]::ErrorGuaranteed>>::{closure#1} as core[5ecddd5f6ab0df47]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7f7e3f170c05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0018b354bb46a254
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/alloc/src/boxed.rs:2007:9
  50:     0x7f7e3f170c05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb166705f6d4a8b53
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/alloc/src/boxed.rs:2007:9
  51:     0x7f7e3f170c05 - std::sys::unix::thread::Thread::new::thread_start::hdac26740529f6e03
                               at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7f7e3ef139eb - <unknown>
  53:     0x7f7e3ef977cc - <unknown>
  54:                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.75.0-nightly (57ef88985 2023-10-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z trait-solver=next-coherence -Z dump-mir-dir=dir

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `Trait`
#1 [coherent_trait] coherence checking all impls of trait `Trait`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

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

@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. F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Oct 13, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 13, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-10-12
Regression in 475c71d
Regression in rust-lang-ci@ae64746
#116219

@compiler-errors
Copy link
Member

Yeah, generic const exprs is not expected to work with the new trait solver.

@compiler-errors compiler-errors removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 14, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 7, 2024
@bors bors closed this as completed in b976142 Apr 7, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 7, 2024
Rollup merge of rust-lang#123579 - matthiaskrgr:I_Love_Tests, r=jieyouxu

add some more tests

Fixes rust-lang#115806
Fixes rust-lang#116710
Fixes rust-lang#123145
Fixes rust-lang#105488
Fixes rust-lang#122488
Fixes rust-lang#123078
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants