Description
auto-reduced (treereduce-rust):
//@compile-flags: -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024
pub struct NoPin;
pub trait PinA<PER> {
const A: u8;
}
impl<PER> PinA<PER> for NoPin {
const A: u8 = 0;
}
pub trait Pins<USART> {}
impl<USART, T> Pins for T where T: PinA<USART, A = { TA }> {}
impl<USART> Serial<USART> where NoPin: Pins<USART> {}
original code
original:
// ICE assertion failed: matches!(self.def_kind(ct.def.did), DefKind :: AnonConst)
// issue: rust-lang/rust#108220
//@ check-pass
#![feature(associated_const_equality)]
#![allow(unused)]
use std::marker::PhantomData;
pub struct NoPin;
pub trait SetAlternate<const A: u8> {}
impl SetAlternate<0> for NoPin {}
pub trait PinA<PER> {
const A: u8;
}
impl<PER> PinA<PER> for NoPin {
const A: u8 = 0;
}
pub trait Pins<USART> {}
impl<USART, T, const TA: u8> Pins<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S
<S<S<S<S<S<S<S<S<S<S<S<S<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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> for T where
T: PinA<USART, A = { TA }> + SetAlternate<TA>
{
}
struct Serial<USART>(PhantomData<USART>);
impl<USART> Serial<USART> where NoPin: Pins<USART> {}
fn main() {}
Version information
rustc 1.87.0-nightly (2f581937e 2025-02-28)
binary: rustc
commit-hash: 2f581937e1c06adb4607df1b571c0bef6d98e6ec
commit-date: 2025-02-28
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
Possibly related line of code:
rust/compiler/rustc_middle/src/mir/interpret/queries.rs
Lines 99 to 111 in 2f58193
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024
Program output
error[E0425]: cannot find value `TA` in this scope
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:13:54
|
13 | impl<USART, T> Pins for T where T: PinA<USART, A = { TA }> {}
| ^^ not found in this scope
error[E0412]: cannot find type `Serial` in this scope
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:15:13
|
15 | impl<USART> Serial<USART> where NoPin: Pins<USART> {}
| ^^^^^^ not found in this scope
error[E0658]: associated const equality is incomplete
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:13:48
|
13 | impl<USART, T> Pins for T where T: PinA<USART, A = { TA }> {}
| ^^^^^^^^^^
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
= note: this compiler was built on 2025-02-28; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:15:54
|
15 | impl<USART> Serial<USART> where NoPin: Pins<USART> {}
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs`
error[E0107]: missing generics for trait `Pins`
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:13:16
|
13 | impl<USART, T> Pins for T where T: PinA<USART, A = { TA }> {}
| ^^^^ expected 1 generic argument
|
note: trait defined here, with 1 generic parameter: `USART`
--> /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:11:11
|
11 | pub trait Pins<USART> {}
| ^^^^ -----
help: add missing generic argument
|
13 | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { TA }> {}
| +++++++
error: internal compiler error: compiler/rustc_middle/src/mir/interpret/queries.rs:105:13: did not expect inference variables here
thread 'rustc' panicked at compiler/rustc_middle/src/mir/interpret/queries.rs:105:13:
Box<dyn Any>
stack backtrace:
0: 0x726a695b8794 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8271bd9d6917c499
1: 0x726a69e166ec - core::fmt::write::hc10118529572c35a
2: 0x726a6af0a4d1 - std::io::Write::write_fmt::hd4cd3c690e338654
3: 0x726a695b85f2 - std::sys::backtrace::BacktraceLock::print::hdbbabde34d7ae3a2
4: 0x726a695bae2e - std::panicking::default_hook::{{closure}}::ha43c2eef4240d1ec
5: 0x726a695baa04 - std::panicking::default_hook::h40675286f8693d93
6: 0x726a687168c7 - std[671130e388b9fe6c]::panicking::update_hook::<alloc[bf8eb75a1b7fb173]::boxed::Box<rustc_driver_impl[91dbdd509552bee2]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x726a695bb6a3 - std::panicking::rust_panic_with_hook::h89d32dff83379cbd
8: 0x726a68753571 - std[671130e388b9fe6c]::panicking::begin_panic::<rustc_errors[498bbaf2ad3cdb45]::ExplicitBug>::{closure#0}
9: 0x726a68747986 - std[671130e388b9fe6c]::sys::backtrace::__rust_end_short_backtrace::<std[671130e388b9fe6c]::panicking::begin_panic<rustc_errors[498bbaf2ad3cdb45]::ExplicitBug>::{closure#0}, !>
10: 0x726a68744309 - std[671130e388b9fe6c]::panicking::begin_panic::<rustc_errors[498bbaf2ad3cdb45]::ExplicitBug>
11: 0x726a6875cf61 - <rustc_errors[498bbaf2ad3cdb45]::diagnostic::BugAbort as rustc_errors[498bbaf2ad3cdb45]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x726a68d312f6 - rustc_middle[5ec6377ace10fe5f]::util::bug::opt_span_bug_fmt::<rustc_span[f0d5d7aa1c3a11e8]::span_encoding::Span>::{closure#0}
13: 0x726a68d18c0a - rustc_middle[5ec6377ace10fe5f]::ty::context::tls::with_opt::<rustc_middle[5ec6377ace10fe5f]::util::bug::opt_span_bug_fmt<rustc_span[f0d5d7aa1c3a11e8]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x726a68d18a7b - rustc_middle[5ec6377ace10fe5f]::ty::context::tls::with_context_opt::<rustc_middle[5ec6377ace10fe5f]::ty::context::tls::with_opt<rustc_middle[5ec6377ace10fe5f]::util::bug::opt_span_bug_fmt<rustc_span[f0d5d7aa1c3a11e8]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x726a6729b9a0 - rustc_middle[5ec6377ace10fe5f]::util::bug::bug_fmt
16: 0x726a6b76eed0 - <rustc_middle[5ec6377ace10fe5f]::ty::context::TyCtxt>::const_eval_resolve_for_typeck.cold
17: 0x726a6a66f9e5 - rustc_trait_selection[f5f12f31b8a38df8]::traits::try_evaluate_const
18: 0x726a6a66f5c3 - <rustc_trait_selection[f5f12f31b8a38df8]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[a5adda4a46b2bae1]::fold::TypeFolder<rustc_middle[5ec6377ace10fe5f]::ty::context::TyCtxt>>::fold_const
19: 0x726a6a1fe71f - rustc_trait_selection[f5f12f31b8a38df8]::traits::project::opt_normalize_projection_term
20: 0x726a69f64281 - rustc_trait_selection[f5f12f31b8a38df8]::traits::project::poly_project_and_unify_term
21: 0x726a69f6a151 - <rustc_trait_selection[f5f12f31b8a38df8]::traits::select::SelectionContext>::evaluate_candidate::{closure#0}
22: 0x726a6ae1e526 - <rustc_trait_selection[f5f12f31b8a38df8]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}
23: 0x726a69fc3ddd - <rustc_trait_selection[f5f12f31b8a38df8]::traits::select::SelectionContext>::poly_select::{closure#0}
24: 0x726a6a6df86f - <rustc_trait_selection[f5f12f31b8a38df8]::traits::fulfill::FulfillProcessor as rustc_data_structures[24cbe30c54d054aa]::obligation_forest::ObligationProcessor>::process_obligation
25: 0x726a69e0e1e9 - <rustc_data_structures[24cbe30c54d054aa]::obligation_forest::ObligationForest<rustc_trait_selection[f5f12f31b8a38df8]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[f5f12f31b8a38df8]::traits::fulfill::FulfillProcessor>
26: 0x726a6a2c4607 - <rustc_trait_selection[f5f12f31b8a38df8]::traits::fulfill::FulfillmentContext<rustc_trait_selection[f5f12f31b8a38df8]::traits::FulfillmentError> as rustc_infer[6424dac916e4534e]::traits::engine::TraitEngine<rustc_trait_selection[f5f12f31b8a38df8]::traits::FulfillmentError>>::select_all_or_error
27: 0x726a6a570a47 - rustc_hir_analysis[5ff3dce2dca2fb41]::check::wfcheck::check_well_formed
28: 0x726a6a56f391 - rustc_query_impl[ee3276488b06594c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ee3276488b06594c]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 1usize]>>
29: 0x726a6a32e1a1 - rustc_query_system[c27e8fb22d1ec87f]::query::plumbing::try_execute_query::<rustc_query_impl[ee3276488b06594c]::DynamicConfig<rustc_data_structures[24cbe30c54d054aa]::vec_cache::VecCache<rustc_span[f0d5d7aa1c3a11e8]::def_id::LocalDefId, rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[c27e8fb22d1ec87f]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[ee3276488b06594c]::plumbing::QueryCtxt, true>
30: 0x726a6a33292c - rustc_query_impl[ee3276488b06594c]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
31: 0x726a6a56c11d - rustc_hir_analysis[5ff3dce2dca2fb41]::check::wfcheck::check_mod_type_wf
32: 0x726a6a56bf1f - rustc_query_impl[ee3276488b06594c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ee3276488b06594c]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 1usize]>>
33: 0x726a6add7120 - rustc_query_system[c27e8fb22d1ec87f]::query::plumbing::try_execute_query::<rustc_query_impl[ee3276488b06594c]::DynamicConfig<rustc_query_system[c27e8fb22d1ec87f]::query::caches::DefaultCache<rustc_span[f0d5d7aa1c3a11e8]::def_id::LocalModDefId, rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ee3276488b06594c]::plumbing::QueryCtxt, true>
34: 0x726a6add7b7b - rustc_query_impl[ee3276488b06594c]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
35: 0x726a6a42258d - rustc_hir_analysis[5ff3dce2dca2fb41]::check_crate
36: 0x726a6a41cb1c - rustc_interface[d2de745071f2696f]::passes::run_required_analyses
37: 0x726a6ae87cfa - rustc_interface[d2de745071f2696f]::passes::analysis
38: 0x726a6ae87cd9 - rustc_query_impl[ee3276488b06594c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ee3276488b06594c]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 0usize]>>
39: 0x726a6ae835aa - rustc_query_system[c27e8fb22d1ec87f]::query::plumbing::try_execute_query::<rustc_query_impl[ee3276488b06594c]::DynamicConfig<rustc_query_system[c27e8fb22d1ec87f]::query::caches::SingleCache<rustc_middle[5ec6377ace10fe5f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[ee3276488b06594c]::plumbing::QueryCtxt, true>
40: 0x726a6ae82fa2 - rustc_query_impl[ee3276488b06594c]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
41: 0x726a6af3fd7c - rustc_interface[d2de745071f2696f]::passes::create_and_enter_global_ctxt::<core[c921f6c857728d82]::option::Option<rustc_interface[d2de745071f2696f]::queries::Linker>, rustc_driver_impl[91dbdd509552bee2]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
42: 0x726a6aef6fa0 - rustc_interface[d2de745071f2696f]::interface::run_compiler::<(), rustc_driver_impl[91dbdd509552bee2]::run_compiler::{closure#0}>::{closure#1}
43: 0x726a6ada9788 - std[671130e388b9fe6c]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d2de745071f2696f]::util::run_in_thread_with_globals<rustc_interface[d2de745071f2696f]::util::run_in_thread_pool_with_globals<rustc_interface[d2de745071f2696f]::interface::run_compiler<(), rustc_driver_impl[91dbdd509552bee2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
44: 0x726a6adaa074 - <<std[671130e388b9fe6c]::thread::Builder>::spawn_unchecked_<rustc_interface[d2de745071f2696f]::util::run_in_thread_with_globals<rustc_interface[d2de745071f2696f]::util::run_in_thread_pool_with_globals<rustc_interface[d2de745071f2696f]::interface::run_compiler<(), rustc_driver_impl[91dbdd509552bee2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c921f6c857728d82]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x726a6adab477 - std::sys::pal::unix::thread::Thread::new::thread_start::h3507b515c9e14c35
46: 0x726a64ea370a - <unknown>
47: 0x726a64f27aac - <unknown>
48: 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.87.0-nightly (2f581937e 2025-02-28) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 -C link-dead-code=true -Z validate-mir
query stack during panic:
#0 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.tBkXQn2yGgp5/rustc_testrunner_tmpdir_reporting.jQl3AZtGBbLi/mvce.rs:15:1: 15:51>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0107, E0412, E0425, E0601, E0658.
For more information about an error, try `rustc --explain E0107`.