Skip to content

ICE: specialization graph: unexpected infer in QueryInput #123155

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(with_negative_coherence)]

pub trait ContainsKey<const K: &'static str> {}

pub trait KeySchema {}

pub struct KeyCons<Tail, const KEY_ID: &'static str> {}

impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
    Tail: KeySchema + ContainsKey<K>
{
}

pub trait ContainsKeyHelper {}

impl<Tail, const KEY_ID: &'static str> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
    Tail: KeySchema + ContainsKey<false, K>
{
}

original:

#![feature(with_negative_coherence)]

pub trait ContainsKey<const K: &'static str> {}

pub trait KeySchema {}

pub struct KeyCons<Tail, const KEY_ID: &'static str> {}

impl<Tail, const KEY_ID: &'static str> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
    Tail: KeySchema + ContainsKey<K>
{
}

pub trait ContainsKeyHelper<const IS_EQUAL: bool> {}

impl<Tail, const KEY_ID: &'static str> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
    Tail: KeySchema + ContainsKey<false, K>
{
}

Version information

rustc 1.79.0-nightly (463a11bef 2024-03-28)
binary: rustc
commit-hash: 463a11bef4d6378439afebf2a9543aef36ccf2c1
commit-date: 2024-03-28
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

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

Program output

error[E0412]: cannot find type `K` in this scope
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:9:37
  |
9 | impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
  |                                     ^ not found in this scope
  |
help: you might be missing a type parameter
  |
9 | impl<Tail, K> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
  |          +++

error[E0412]: cannot find type `KEY_ID` in this scope
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:9:58
  |
9 | impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
  |                                                          ^^^^^^ not found in this scope
  |
help: you might be missing a type parameter
  |
9 | impl<Tail, KEY_ID> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
  |          ++++++++

error[E0412]: cannot find type `K` in this scope
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:10:35
   |
10 |     Tail: KeySchema + ContainsKey<K>
   |                                   ^ not found in this scope
   |
help: you might be missing a type parameter
   |
9  | impl<Tail, K> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |          +++

error[E0412]: cannot find type `K` in this scope
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:16:65
   |
16 | impl<Tail, const KEY_ID: &'static str> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |                                                                 ^ not found in this scope
   |
help: you might be missing a type parameter
   |
16 | impl<Tail, const KEY_ID: &'static str, K> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |                                      +++

error[E0412]: cannot find type `K` in this scope
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:17:42
   |
17 |     Tail: KeySchema + ContainsKey<false, K>
   |                                          ^ not found in this scope
   |
help: you might be missing a type parameter
   |
16 | impl<Tail, const KEY_ID: &'static str, K> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |                                      +++

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:19:2
   |
19 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs`

error: `&'static str` is forbidden as the type of a const generic parameter
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:3:32
  |
3 | pub trait ContainsKey<const K: &'static str> {}
  |                                ^^^^^^^^^^^^
  |
  = note: the only supported types are integers, `bool` and `char`
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
  |
3 + #![feature(adt_const_params)]
  |

error[E0392]: type parameter `Tail` is never used
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:7:20
  |
7 | pub struct KeyCons<Tail, const KEY_ID: &'static str> {}
  |                    ^^^^ unused type parameter
  |
  = help: consider removing `Tail`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `Tail` to be a const parameter, use `const Tail: /* Type */` instead

error: `&'static str` is forbidden as the type of a const generic parameter
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:7:40
  |
7 | pub struct KeyCons<Tail, const KEY_ID: &'static str> {}
  |                                        ^^^^^^^^^^^^
  |
  = note: the only supported types are integers, `bool` and `char`
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
  |
3 + #![feature(adt_const_params)]
  |

error[E0747]: unresolved item provided when a constant was expected
 --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:9:58
  |
9 | impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
  |                                                          ^^^^^^
  |
help: if this generic argument was intended as a const parameter, surround it with braces
  |
9 | impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, { KEY_ID }> where
  |                                                          +        +

error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:9:12
   |
9  | impl<Tail> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |            ^^^^^^^^^^^^^^^^^---------- help: remove these generics
   |            |
   |            expected 0 generic arguments
   |
note: trait defined here, with 0 generic parameters
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:14:11
   |
14 | pub trait ContainsKeyHelper {}
   |           ^^^^^^^^^^^^^^^^^

error[E0747]: unresolved item provided when a constant was expected
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:10:35
   |
10 |     Tail: KeySchema + ContainsKey<K>
   |                                   ^
   |
help: if this generic argument was intended as a const parameter, surround it with braces
   |
10 |     Tail: KeySchema + ContainsKey<{ K }>
   |                                   +   +

error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:16:40
   |
16 | impl<Tail, const KEY_ID: &'static str> ContainsKeyHelper<false, K> for KeyCons<Tail, KEY_ID> where
   |                                        ^^^^^^^^^^^^^^^^^---------- help: remove these generics
   |                                        |
   |                                        expected 0 generic arguments
   |
note: trait defined here, with 0 generic parameters
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:14:11
   |
14 | pub trait ContainsKeyHelper {}
   |           ^^^^^^^^^^^^^^^^^

error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:17:23
   |
17 |     Tail: KeySchema + ContainsKey<false, K>
   |                       ^^^^^^^^^^^        - help: remove this generic argument
   |                       |
   |                       expected 1 generic argument
   |
note: trait defined here, with 1 generic parameter: `K`
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:3:11
   |
3  | pub trait ContainsKey<const K: &'static str> {}
   |           ^^^^^^^^^^^ ---------------------

thread 'rustc' panicked at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/compiler/rustc_next_trait_solver/src/canonicalizer.rs:67:9:
unexpected infer in QueryInput { goal: Goal { predicate: Binder { value: NormalizesTo(AliasTy { args: [], def_id: DefId(0:16 ~ mvce[cf35]::{impl#1}::{constant#0}) }, Term::Ct(^1_0: &'?0 str)), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [Binder { value: TraitPredicate(<^1_1 as ContainsKey<{const error}>>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<^1_1 as KeySchema>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<^1_1 as std::marker::Sized>, polarity:Positive), bound_vars: [] }], reveal: UserFacing } }, anchor: Bind([]), predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }
stack backtrace:
   0:     0x7cd0fcffd2a5 - std::backtrace_rs::backtrace::libunwind::trace::hc9ad77caa68248e0
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7cd0fcffd2a5 - std::backtrace_rs::backtrace::trace_unsynchronized::hdb167fe848110c22
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7cd0fcffd2a5 - std::sys_common::backtrace::_print_fmt::hf60d026528b44cae
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7cd0fcffd2a5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h77057cdf9abd0a3b
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7cd0fd04e64b - core::fmt::rt::Argument::fmt::h2d5682051c912193
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/core/src/fmt/rt.rs:142:9
   5:     0x7cd0fd04e64b - core::fmt::write::h91045f17dad5810f
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/core/src/fmt/mod.rs:1153:17
   6:     0x7cd0fcff1f0f - std::io::Write::write_fmt::h9aaeb0d030b375cc
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/io/mod.rs:1843:15
   7:     0x7cd0fcffd07e - std::sys_common::backtrace::_print::hcbf63c33da44def2
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7cd0fcffd07e - std::sys_common::backtrace::print::h53b1e15a738ad4ac
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7cd0fcfffd29 - std::panicking::default_hook::{{closure}}::h08fdf489308ec011
  10:     0x7cd0fcfffa93 - std::panicking::default_hook::h0eff550faf8f8601
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/panicking.rs:292:9
  11:     0x7cd0f99fa06e - std[598b8342d1a3a4e8]::panicking::update_hook::<alloc[63ad465720ca4612]::boxed::Box<rustc_driver_impl[69f15d569c4f2de1]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7cd0fd00042c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h20a693632b460b24
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/alloc/src/boxed.rs:2032:9
  13:     0x7cd0fd00042c - std::panicking::rust_panic_with_hook::hefd953fb72b64219
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/panicking.rs:793:13
  14:     0x7cd0fd0001d6 - std::panicking::begin_panic_handler::{{closure}}::hdc56613d7db54a00
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/panicking.rs:658:13
  15:     0x7cd0fcffd769 - std::sys_common::backtrace::__rust_end_short_backtrace::hb81e2ffdefb458a7
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7cd0fcffff07 - rust_begin_unwind
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/panicking.rs:646:5
  17:     0x7cd0fd04aae6 - core::panicking::panic_fmt::h9e3c9a0f50b4a31d
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/core/src/panicking.rs:72:14
  18:     0x7cd0fa4c902b - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::canonicalize_goal::<rustc_middle[13a917e17ab0fec8]::ty::predicate::Predicate>
  19:     0x7cd0fa4ccb6b - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_goal_raw
  20:     0x7cd0fa5105e4 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::try_evaluate_added_goals
  21:     0x7cd0fa50b640 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::try_normalize_term
  22:     0x7cd0fa4dbbf9 - <rustc_trait_selection[f9161e542b264224]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#3}
  23:     0x7cd0fa4d90e6 - <rustc_trait_selection[f9161e542b264224]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
  24:     0x7cd0fa4cce27 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_goal_raw
  25:     0x7cd0fa4cca82 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  26:     0x7cd0fa510c9d - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::try_evaluate_added_goals
  27:     0x7cd0fa50bca2 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_added_goals_and_make_canonical_response
  28:     0x7cd0fa4dfcac - <rustc_middle[13a917e17ab0fec8]::ty::predicate::TraitPredicate as rustc_trait_selection[f9161e542b264224]::solve::assembly::GoalKind>::probe_and_match_goal_against_assumption::<<rustc_middle[13a917e17ab0fec8]::ty::predicate::TraitPredicate as rustc_trait_selection[f9161e542b264224]::solve::assembly::GoalKind>::consider_implied_clause<[rustc_middle[13a917e17ab0fec8]::traits::solve::Goal<rustc_middle[13a917e17ab0fec8]::ty::predicate::Predicate>; 0usize]>::{closure#0}>
  29:     0x7cd0fa50b9d8 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::assemble_param_env_candidates::<rustc_middle[13a917e17ab0fec8]::ty::predicate::TraitPredicate>
  30:     0x7cd0fa4c6dcc - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::assemble_and_evaluate_candidates::<rustc_middle[13a917e17ab0fec8]::ty::predicate::TraitPredicate>
  31:     0x7cd0fa4dbe1e - <rustc_trait_selection[f9161e542b264224]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#3}
  32:     0x7cd0fa4d90e6 - <rustc_trait_selection[f9161e542b264224]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
  33:     0x7cd0fa4cce27 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_goal_raw
  34:     0x7cd0fa4cca82 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  35:     0x7cd0fa4cc7d3 - <rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::EvalCtxt>::enter_root::<core[aba9afb3109def9a]::result::Result<(bool, rustc_middle[13a917e17ab0fec8]::traits::solve::Certainty), rustc_middle[13a917e17ab0fec8]::traits::query::NoSolution>, <rustc_infer[812af40bedf8970a]::infer::InferCtxt as rustc_trait_selection[f9161e542b264224]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal::{closure#0}>
  36:     0x7cd0fa4cf244 - <rustc_trait_selection[f9161e542b264224]::solve::fulfill::FulfillmentCtxt as rustc_infer[812af40bedf8970a]::traits::engine::TraitEngine>::select_where_possible
  37:     0x7cd0fa491540 - <rustc_trait_selection[f9161e542b264224]::solve::fulfill::FulfillmentCtxt as rustc_infer[812af40bedf8970a]::traits::engine::TraitEngineExt>::select_all_or_error
  38:     0x7cd0fa4eaecc - rustc_trait_selection[f9161e542b264224]::traits::coherence::impl_intersection_has_negative_obligation
  39:     0x7cd0fb49cb09 - rustc_trait_selection[f9161e542b264224]::traits::coherence::overlap
  40:     0x7cd0fbb6e0a4 - <rustc_middle[13a917e17ab0fec8]::traits::specialization_graph::Children as rustc_trait_selection[f9161e542b264224]::traits::specialize::specialization_graph::ChildrenExt>::insert
  41:     0x7cd0f87b4f4b - <rustc_middle[13a917e17ab0fec8]::traits::specialization_graph::Graph as rustc_trait_selection[f9161e542b264224]::traits::specialize::specialization_graph::GraphExt>::insert
  42:     0x7cd0fafcca05 - rustc_trait_selection[f9161e542b264224]::traits::specialize::specialization_graph_provider
  43:     0x7cd0fafcc55d - rustc_query_impl[1ebd684e80feb137]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1ebd684e80feb137]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 8usize]>>
  44:     0x7cd0fafcf01e - rustc_query_system[47def78e3fe379f5]::query::plumbing::try_execute_query::<rustc_query_impl[1ebd684e80feb137]::DynamicConfig<rustc_query_system[47def78e3fe379f5]::query::caches::DefIdCache<rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[1ebd684e80feb137]::plumbing::QueryCtxt, false>
  45:     0x7cd0fb5429de - rustc_query_impl[1ebd684e80feb137]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7cd0fb60d8f1 - rustc_hir_analysis[cf06ecc502e6f33f]::coherence::coherent_trait
  47:     0x7cd0fb60d5e7 - rustc_query_impl[1ebd684e80feb137]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1ebd684e80feb137]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>
  48:     0x7cd0fb107810 - rustc_query_system[47def78e3fe379f5]::query::plumbing::try_execute_query::<rustc_query_impl[1ebd684e80feb137]::DynamicConfig<rustc_query_system[47def78e3fe379f5]::query::caches::DefIdCache<rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1ebd684e80feb137]::plumbing::QueryCtxt, false>
  49:     0x7cd0fb4326d7 - rustc_query_impl[1ebd684e80feb137]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7cd0fb44502b - rustc_hir_analysis[cf06ecc502e6f33f]::check::wfcheck::check_well_formed
  51:     0x7cd0fb442deb - rustc_query_impl[1ebd684e80feb137]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1ebd684e80feb137]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>
  52:     0x7cd0fb442580 - rustc_query_system[47def78e3fe379f5]::query::plumbing::try_execute_query::<rustc_query_impl[1ebd684e80feb137]::DynamicConfig<rustc_query_system[47def78e3fe379f5]::query::caches::VecCache<rustc_hir[937210ed3bec7ff3]::hir_id::OwnerId, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1ebd684e80feb137]::plumbing::QueryCtxt, false>
  53:     0x7cd0fb4422ff - rustc_query_impl[1ebd684e80feb137]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7cd0fb44023a - rustc_hir_analysis[cf06ecc502e6f33f]::check::wfcheck::check_mod_type_wf
  55:     0x7cd0fb440061 - rustc_query_impl[1ebd684e80feb137]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1ebd684e80feb137]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>
  56:     0x7cd0fb8ca2b0 - rustc_query_system[47def78e3fe379f5]::query::plumbing::try_execute_query::<rustc_query_impl[1ebd684e80feb137]::DynamicConfig<rustc_query_system[47def78e3fe379f5]::query::caches::DefaultCache<rustc_span[a52ae730658d6744]::def_id::LocalModDefId, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1ebd684e80feb137]::plumbing::QueryCtxt, false>
  57:     0x7cd0fb8ca05b - rustc_query_impl[1ebd684e80feb137]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  58:     0x7cd0fafe503f - rustc_hir_analysis[cf06ecc502e6f33f]::check_crate
  59:     0x7cd0fb356daa - rustc_interface[af68b54697b6df15]::passes::analysis
  60:     0x7cd0fb356913 - rustc_query_impl[1ebd684e80feb137]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1ebd684e80feb137]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>
  61:     0x7cd0fbbd8365 - rustc_query_system[47def78e3fe379f5]::query::plumbing::try_execute_query::<rustc_query_impl[1ebd684e80feb137]::DynamicConfig<rustc_query_system[47def78e3fe379f5]::query::caches::SingleCache<rustc_middle[13a917e17ab0fec8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1ebd684e80feb137]::plumbing::QueryCtxt, false>
  62:     0x7cd0fbbd80c9 - rustc_query_impl[1ebd684e80feb137]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  63:     0x7cd0fba84685 - rustc_interface[af68b54697b6df15]::interface::run_compiler::<core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>, rustc_driver_impl[69f15d569c4f2de1]::run_compiler::{closure#0}>::{closure#0}
  64:     0x7cd0fbb73663 - std[598b8342d1a3a4e8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[af68b54697b6df15]::util::run_in_thread_with_globals<rustc_interface[af68b54697b6df15]::util::run_in_thread_pool_with_globals<rustc_interface[af68b54697b6df15]::interface::run_compiler<core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>, rustc_driver_impl[69f15d569c4f2de1]::run_compiler::{closure#0}>::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>
  65:     0x7cd0fbb73490 - <<std[598b8342d1a3a4e8]::thread::Builder>::spawn_unchecked_<rustc_interface[af68b54697b6df15]::util::run_in_thread_with_globals<rustc_interface[af68b54697b6df15]::util::run_in_thread_pool_with_globals<rustc_interface[af68b54697b6df15]::interface::run_compiler<core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>, rustc_driver_impl[69f15d569c4f2de1]::run_compiler::{closure#0}>::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[aba9afb3109def9a]::result::Result<(), rustc_span[a52ae730658d6744]::ErrorGuaranteed>>::{closure#1} as core[aba9afb3109def9a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  66:     0x7cd0fd009d89 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0da6186c2c724e12
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/alloc/src/boxed.rs:2018:9
  67:     0x7cd0fd009d89 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb8df2349f2e6b3c3
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/alloc/src/boxed.rs:2018:9
  68:     0x7cd0fd009d89 - std::sys::pal::unix::thread::Thread::new::thread_start::hd76932c3803a914a
                               at /rustc/463a11bef4d6378439afebf2a9543aef36ccf2c1/library/std/src/sys/pal/unix/thread.rs:108:17
  69:     0x7cd0f68a955a - <unknown>
  70:     0x7cd0f6926a3c - <unknown>
  71:                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.79.0-nightly (463a11bef 2024-03-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `ContainsKeyHelper`
#1 [coherent_trait] coherence checking all impls of trait `ContainsKeyHelper`
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:9:1: 10:37>` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error[E0308]: mismatched types
  --> /tmp/icemaker_global_tempdir.GJcVylPrIFuu/rustc_testrunner_tmpdir_reporting.nT7ghpao5shm/mvce.rs:17:35
   |
17 |     Tail: KeySchema + ContainsKey<false, K>
   |                                   ^^^^^ expected `&str`, found `bool`

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0107, E0308, E0392, E0412, E0601, E0747.
For more information about an error, try `rustc --explain E0107`.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Mar 28, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 28, 2024
  3. changed the title [-]ICE: specialization: `unexpected infer in QueryInput`[/-] [+]ICE: specialization graph: `unexpected infer in QueryInput`[/+] on Mar 28, 2024
  4. matthiaskrgr commented on Mar 28, 2024

    @matthiaskrgr
    MemberAuthor
  5. compiler-errors commented on Mar 28, 2024

    @compiler-errors
    Contributor

    This should get minimized more

  6. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Mar 28, 2024
  7. matthiaskrgr commented on Mar 28, 2024

    @matthiaskrgr
    MemberAuthor

    hmm, bit smaller:

    #![feature(with_negative_coherence)]
    
    pub trait A<const K: &'static str> {}
    
    pub struct B<Tail> {}
    
    impl<Tail> C<K> for B<Tail> where Tail: A<K> {}
    
    pub trait C {}
    
    impl<Tail, const KEY_ID: &'static str> C<K> for B<Tail> where Tail: A<false, K> {}
  8. compiler-errors commented on Mar 28, 2024

    @compiler-errors
    Contributor

    There's still an overwhelming number of compiler errors that can be suppressed very easily, and that really occlude the underlying issue (type mismatch in a const generic parameter). That's what I mean by minimization:

    #![feature(with_negative_coherence)]
    
    pub trait A<const K: &'static str> {}
    pub trait C {}
    
    impl<T> C for T where T: A<""> {}
    impl<T> C for T where T: A<false> {}
  9. removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Mar 28, 2024
  10. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 28, 2024
  11. added 2 commits that reference this issue on Mar 30, 2024
  12. added a commit that references this issue on Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-with_negative_coherence`#![feature(with_negative_coherence)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions