Skip to content

ice assertion failed: !value.has_infer() #115806

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc file.rs '-Ztrait-solver=next-coherence'

pub struct NoPin;

impl Pins<TA> for NoPin {}

pub trait PinA<PER> {
    const A: &'static () = unsafe {};
}

pub trait Pins<USART> {}

impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { TA }> {}

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (e5fedceab 2023-09-12)
binary: rustc
commit-hash: e5fedceabf4e0564231db592b6d1f35e1ca27908
commit-date: 2023-09-12
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output

error[E0412]: cannot find type `TA` in this scope
 --> a.rs:3:11
  |
3 | impl Pins<TA> for NoPin {}
  |           ^^ not found in this scope
  |
help: you might be missing a type parameter
  |
3 | impl<TA> Pins<TA> for NoPin {}
  |     ++++

error[E0425]: cannot find value `TA` in this scope
  --> a.rs:11:61
   |
11 | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { TA }> {}
   |                                                             ^^ not found in this scope

error[E0658]: associated const equality is incomplete
  --> a.rs:11:55
   |
11 | impl<USART, T> Pins<USART> 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

error[E0601]: `main` function not found in crate `a`
  --> a.rs:11:69
   |
11 | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { TA }> {}
   |                          
Backtrace

thread 'rustc' panicked at compiler/rustc_trait_selection/src/solve/canonicalize.rs:72:9:
assertion failed: !value.has_infer()
stack backtrace:
   0:     0x7f1f63762efc - std::backtrace_rs::backtrace::libunwind::trace::h170ba77b7937dfc1
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1f63762efc - std::backtrace_rs::backtrace::trace_unsynchronized::ha3ffdef167b36dcf
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1f63762efc - std::sys_common::backtrace::_print_fmt::h3593f75d449d7c19
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f1f63762efc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3d681876fb1a0c35
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1f637c915c - core::fmt::rt::Argument::fmt::h28dae40336be117d
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/core/src/fmt/rt.rs:138:9
   5:     0x7f1f637c915c - core::fmt::write::hc7ede5ba8d1b34fc
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f1f6375593e - std::io::Write::write_fmt::h4b5cbdfd5c06e4d9
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/io/mod.rs:1714:15
   7:     0x7f1f63762ce4 - std::sys_common::backtrace::_print::hf9f8d894d0fba8f4
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1f63762ce4 - std::sys_common::backtrace::print::h6736ec2ce0b1565d
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1f63765dda - std::panicking::panic_hook_with_disk_dump::{{closure}}::h23059af5ca98b58a
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/panicking.rs:280:22
  10:     0x7f1f63765ad5 - std::panicking::panic_hook_with_disk_dump::h6a2d92a5ff298e6f
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/panicking.rs:314:9
  11:     0x7f1f66951e49 - rustc_driver_impl[f8442aae50b2ebe1]::install_ice_hook::{closure#0}
  12:     0x7f1f63766693 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h34ea97e0bbf89982
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/alloc/src/boxed.rs:2021:9
  13:     0x7f1f63766693 - std::panicking::rust_panic_with_hook::h71b4835249b93020
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/panicking.rs:757:13
  14:     0x7f1f637663c6 - std::panicking::begin_panic_handler::{{closure}}::haf0bd6f65b167fe9
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/panicking.rs:623:13
  15:     0x7f1f63763426 - std::sys_common::backtrace::__rust_end_short_backtrace::hec6b1c9c3aaa2fc0
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f1f63766152 - rust_begin_unwind
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/panicking.rs:619:5
  17:     0x7f1f637c5505 - core::panicking::panic_fmt::hfe421f38e4eebe22
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/core/src/panicking.rs:72:14
  18:     0x7f1f637c55a3 - core::panicking::panic::h78eb9cd691eeb3c6
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/core/src/panicking.rs:127:5
  19:     0x7f1f6757c25d - <rustc_trait_selection[96d2226668d5f153]::solve::canonicalize::Canonicalizer>::canonicalize::<rustc_middle[b639b8b23e8d3436]::traits::solve::QueryInput<rustc_middle[b639b8b23e8d3436]::ty::Predicate>>
  20:     0x7f1f675ec009 - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::canonicalize_goal::<rustc_middle[b639b8b23e8d3436]::ty::Predicate>
  21:     0x7f1f675f074c - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  22:     0x7f1f675f85ff - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::try_evaluate_added_goals
  23:     0x7f1f675f4db1 - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_added_goals_and_make_canonical_response
  24:     0x7f1f675f6715 - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}::{closure#0}
  25:     0x7f1f675f0541 - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::enter_canonical::<core[8975a1ebd15850b5]::result::Result<rustc_middle[b639b8b23e8d3436]::infer::canonical::Canonical<rustc_middle[b639b8b23e8d3436]::traits::solve::Response>, rustc_middle[b639b8b23e8d3436]::traits::query::NoSolution>, <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}::{closure#0}>
  26:     0x7f1f675b857a - <rustc_trait_selection[96d2226668d5f153]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
  27:     0x7f1f675b8227 - <rustc_trait_selection[96d2226668d5f153]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
  28:     0x7f1f675f086f - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  29:     0x7f1f675f0049 - <rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::EvalCtxt>::enter_root::<core[8975a1ebd15850b5]::result::Result<(bool, rustc_middle[b639b8b23e8d3436]::traits::solve::Certainty, alloc[881c01e0431dac23]::vec::Vec<rustc_middle[b639b8b23e8d3436]::traits::solve::Goal<rustc_middle[b639b8b23e8d3436]::ty::Predicate>>), rustc_middle[b639b8b23e8d3436]::traits::query::NoSolution>, <rustc_infer[15041e1b2e69e7cb]::infer::InferCtxt as rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal::{closure#0}::{closure#0}>
  30:     0x7f1f675253c4 - <rustc_infer[15041e1b2e69e7cb]::infer::InferCtxt as rustc_trait_selection[96d2226668d5f153]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal
  31:     0x7f1f675af30a - <rustc_trait_selection[96d2226668d5f153]::solve::fulfill::FulfillmentCtxt as rustc_infer[15041e1b2e69e7cb]::traits::engine::TraitEngine>::select_where_possible
  32:     0x7f1f64f6e8a4 - <rustc_infer[15041e1b2e69e7cb]::infer::InferCtxt as rustc_trait_selection[96d2226668d5f153]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  33:     0x7f1f65b90720 - <core[8975a1ebd15850b5]::iter::adapters::map::Map<core[8975a1ebd15850b5]::iter::adapters::flatten::Flatten<core[8975a1ebd15850b5]::array::iter::IntoIter<&alloc[881c01e0431dac23]::vec::Vec<rustc_middle[b639b8b23e8d3436]::ty::Predicate>, 2usize>>, rustc_trait_selection[96d2226668d5f153]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#0}> as core[8975a1ebd15850b5]::iter::traits::iterator::Iterator>::try_fold::<(), core[8975a1ebd15850b5]::iter::traits::iterator::Iterator::find::check<rustc_infer[15041e1b2e69e7cb]::traits::Obligation<rustc_middle[b639b8b23e8d3436]::ty::Predicate>, &mut rustc_trait_selection[96d2226668d5f153]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#1}>::{closure#0}, core[8975a1ebd15850b5]::ops::control_flow::ControlFlow<rustc_infer[15041e1b2e69e7cb]::traits::Obligation<rustc_middle[b639b8b23e8d3436]::ty::Predicate>>>
  34:     0x7f1f65b904ab - <rustc_trait_selection[96d2226668d5f153]::traits::select::SelectionContext>::with_treat_inductive_cycle_as::<core[8975a1ebd15850b5]::option::Option<rustc_infer[15041e1b2e69e7cb]::traits::Obligation<rustc_middle[b639b8b23e8d3436]::ty::Predicate>>, rustc_trait_selection[96d2226668d5f153]::traits::coherence::overlap::{closure#0}>
  35:     0x7f1f65b8f8a6 - rustc_trait_selection[96d2226668d5f153]::traits::coherence::overlap
  36:     0x7f1f65c26208 - <rustc_middle[b639b8b23e8d3436]::traits::specialization_graph::Children as rustc_trait_selection[96d2226668d5f153]::traits::specialize::specialization_graph::ChildrenExt>::insert
  37:     0x7f1f65c24603 - <rustc_middle[b639b8b23e8d3436]::traits::specialization_graph::Graph as rustc_trait_selection[96d2226668d5f153]::traits::specialize::specialization_graph::GraphExt>::insert
  38:     0x7f1f65c23345 - rustc_trait_selection[96d2226668d5f153]::traits::specialize::specialization_graph_provider
  39:     0x7f1f65cebd0b - rustc_query_impl[5d5a3cff05f7bed8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d5a3cff05f7bed8]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7f1f65cebce1 - <rustc_query_impl[5d5a3cff05f7bed8]::query_impl::specialization_graph_of::dynamic_query::{closure#2} as core[8975a1ebd15850b5]::ops::function::FnOnce<(rustc_middle[b639b8b23e8d3436]::ty::context::TyCtxt, rustc_span[319b9c0a2f58e367]::def_id::DefId)>>::call_once
  41:     0x7f1f64a4e490 - rustc_query_system[50f896f966c25655]::query::plumbing::try_execute_query::<rustc_query_impl[5d5a3cff05f7bed8]::DynamicConfig<rustc_query_system[50f896f966c25655]::query::caches::DefaultCache<rustc_span[319b9c0a2f58e367]::def_id::DefId, rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5d5a3cff05f7bed8]::plumbing::QueryCtxt, false>
  42:     0x7f1f662dd1c2 - rustc_query_impl[5d5a3cff05f7bed8]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7f1f65f5613f - rustc_hir_analysis[788a263b067e3e39]::coherence::coherent_trait
  44:     0x7f1f65602911 - rustc_query_impl[5d5a3cff05f7bed8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d5a3cff05f7bed8]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 0usize]>>
  45:     0x7f1f656028f1 - <rustc_query_impl[5d5a3cff05f7bed8]::query_impl::coherent_trait::dynamic_query::{closure#2} as core[8975a1ebd15850b5]::ops::function::FnOnce<(rustc_middle[b639b8b23e8d3436]::ty::context::TyCtxt, rustc_span[319b9c0a2f58e367]::def_id::DefId)>>::call_once
  46:     0x7f1f65de84c5 - rustc_query_system[50f896f966c25655]::query::plumbing::try_execute_query::<rustc_query_impl[5d5a3cff05f7bed8]::DynamicConfig<rustc_query_system[50f896f966c25655]::query::caches::DefaultCache<rustc_span[319b9c0a2f58e367]::def_id::DefId, rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[5d5a3cff05f7bed8]::plumbing::QueryCtxt, false>
  47:     0x7f1f65de81de - rustc_query_impl[5d5a3cff05f7bed8]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7f1f65b1e68d - rustc_hir_analysis[788a263b067e3e39]::check_crate
  49:     0x7f1f65b15252 - rustc_interface[afabc26049662c5e]::passes::analysis
  50:     0x7f1f65d9f46a - rustc_query_impl[5d5a3cff05f7bed8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5d5a3cff05f7bed8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f1f65d9f459 - <rustc_query_impl[5d5a3cff05f7bed8]::query_impl::analysis::dynamic_query::{closure#2} as core[8975a1ebd15850b5]::ops::function::FnOnce<(rustc_middle[b639b8b23e8d3436]::ty::context::TyCtxt, ())>>::call_once
  52:     0x7f1f66085174 - rustc_query_system[50f896f966c25655]::query::plumbing::try_execute_query::<rustc_query_impl[5d5a3cff05f7bed8]::DynamicConfig<rustc_query_system[50f896f966c25655]::query::caches::SingleCache<rustc_middle[b639b8b23e8d3436]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5d5a3cff05f7bed8]::plumbing::QueryCtxt, false>
  53:     0x7f1f66084ee9 - rustc_query_impl[5d5a3cff05f7bed8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7f1f65e6ac13 - <rustc_middle[b639b8b23e8d3436]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[f8442aae50b2ebe1]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>
  55:     0x7f1f65e69d08 - <rustc_interface[afabc26049662c5e]::interface::Compiler>::enter::<rustc_driver_impl[f8442aae50b2ebe1]::run_compiler::{closure#1}::{closure#2}, core[8975a1ebd15850b5]::result::Result<core[8975a1ebd15850b5]::option::Option<rustc_interface[afabc26049662c5e]::queries::Linker>, rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>
  56:     0x7f1f65e62fd4 - std[ba7dab7da19e8c24]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[afabc26049662c5e]::util::run_in_thread_with_globals<rustc_interface[afabc26049662c5e]::interface::run_compiler<core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>, rustc_driver_impl[f8442aae50b2ebe1]::run_compiler::{closure#1}>::{closure#0}, core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>
  57:     0x7f1f65e6272e - <<std[ba7dab7da19e8c24]::thread::Builder>::spawn_unchecked_<rustc_interface[afabc26049662c5e]::util::run_in_thread_with_globals<rustc_interface[afabc26049662c5e]::interface::run_compiler<core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>, rustc_driver_impl[f8442aae50b2ebe1]::run_compiler::{closure#1}>::{closure#0}, core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8975a1ebd15850b5]::result::Result<(), rustc_span[319b9c0a2f58e367]::ErrorGuaranteed>>::{closure#1} as core[8975a1ebd15850b5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x7f1f63771075 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf087c3a953991192
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/alloc/src/boxed.rs:2007:9
  59:     0x7f1f63771075 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h911ae42726efeb98
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/alloc/src/boxed.rs:2007:9
  60:     0x7f1f63771075 - std::sys::unix::thread::Thread::new::thread_start::hb163d3257e70a2e6
                               at /rustc/b4e54c6e39984840a04dcd02d14ec8c3574d30e5/library/std/src/sys/unix/thread.rs:108:17
  61:     0x7f1f6328c9eb - <unknown>
  62:     0x7f1f63310dfc - <unknown>
  63:                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: please attach the file at `/home/matthias/vcs/github/glacier2/fixed/icemaker_omni/rustc-ice-2023-09-13T04:37:19.996986669Z-1160451.txt` to your bug report

note: compiler flags: -Z trait-solver=next-coherence

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions