rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.33k stars 12.72k forks source link

ice: `unknown alias DefKind: AnonConst` #116710

Closed matthiaskrgr closed 7 months ago

matthiaskrgr commented 1 year ago

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; | ^^ 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 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 Trait for Uwu {} | ^ 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 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 - ::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::>::{closure#0} 12: 0x7f7e3f165c98 - as core::ops::function::Fn>::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::::{closure#0} 15: 0x7f7e420c0f16 - std[5f80c380de201c9c]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7f7e420bb8c6 - std[5f80c380de201c9c]::panicking::begin_panic:: 17: 0x7f7e420a4584 - ::bug:: 18: 0x7f7e420a4344 - ::bug:: 19: 0x7f7e42145abd - rustc_middle[48fc6e82f368dfd0]::util::bug::opt_span_bug_fmt::::{closure#0} 20: 0x7f7e4212c37a - rustc_middle[48fc6e82f368dfd0]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 21: 0x7f7e4212c238 - rustc_middle[48fc6e82f368dfd0]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 22: 0x7f7e401ba6a0 - rustc_middle[48fc6e82f368dfd0]::util::bug::bug_fmt 23: 0x7f7e40889ede - ::eq:: 24: 0x7f7e426e24fb - ::eq:: 25: 0x7f7e4268614a - ::with_new_goal::<::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2} 26: 0x7f7e42684331 - ::with_new_goal::<::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}> 27: 0x7f7e4267a808 - ::evaluate_goal 28: 0x7f7e426e0ec6 - ::evaluate_root_goal 29: 0x7f7e4267bf9f - ::select_where_possible 30: 0x7f7e405736eb - ::evaluate_obligation 31: 0x7f7e413765b5 - rustc_trait_selection[5d100321d2a01e19]::traits::coherence::overlap 32: 0x7f7e413738cf - ::insert 33: 0x7f7e41371a49 - ::insert 34: 0x7f7e4136f8aa - rustc_trait_selection[5d100321d2a01e19]::traits::specialize::specialization_graph_provider 35: 0x7f7e412871ea - rustc_query_impl[d93ff4b57be0a3f9]::plumbing::__rust_begin_short_backtrace::> 36: 0x7f7e403cf2d1 - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::>, 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::> 40: 0x7f7e4145fa6b - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::>, 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::> 45: 0x7f7e415cb3f6 - rustc_query_system[bf593801cb8c9f4a]::query::plumbing::try_execute_query::>, 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_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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::h0018b354bb46a254 at /rustc/57ef8898520f7ff2c60341636bb86d94cb550e79/library/alloc/src/boxed.rs:2007:9 50: 0x7f7e3f170c05 - as core::ops::function::FnOnce>::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 - 53: 0x7f7e3ef977cc - 54: 0x0 - 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 commented 1 year ago

Regression in nightly-2023-10-12 Regression in 475c71da0710fd1d40c046f9cee04b733b5b2b51 Regression in https://github.com/rust-lang-ci/rust/commit/ae64746194d5617d58e8cf5065a9b146dfc74a06

116219

compiler-errors commented 1 year ago

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