Open
Description
Code
this compiles:
#![feature(unsized_const_params)]
#![feature(with_negative_coherence, negative_impls)]
trait a < const b : &'static str> {} trait c {} struct d< e >(e);
impl<e> c for e where e: a<""> {}
impl<e> c for d<e> {}
impl<e> !a<f> for e {}
const f : &str = "";
fn main() {}
but if we add
#![feature(min_generic_const_args)]
it will ice:
#![feature(min_generic_const_args)]
#![feature(unsized_const_params)]
#![feature(with_negative_coherence, negative_impls)]
trait a < const b : &'static str> {} trait c {} struct d< e >(e);
impl<e> c for e where e: a<""> {}
impl<e> c for d<e> {}
impl<e> !a<f> for e {}
const f : &str = "";
fn main() {}
it ICEs
Meta
rustc --version --verbose
:
<version>
Error output
warning: trait `a` should have an upper camel case name
--> code.rs:4:7
|
4 | trait a < const b : &'static str> {} trait c {} struct d< e >(e);
| ^ help: convert the identifier to upper camel case: `A`
|
= note: `#[warn(non_camel_case_types)]` on by default
warning: trait `c` should have an upper camel case name
--> code.rs:4:44
|
4 | trait a < const b : &'static str> {} trait c {} struct d< e >(e);
| ^ help: convert the identifier to upper camel case (notice the capitalization): `C`
warning: type `d` should have an upper camel case name
--> code.rs:4:56
|
4 | trait a < const b : &'static str> {} trait c {} struct d< e >(e);
| ^ help: convert the identifier to upper camel case: `D`
warning: type parameter `e` should have an upper camel case name
--> code.rs:4:59
|
4 | trait a < const b : &'static str> {} trait c {} struct d< e >(e);
| ^ help: convert the identifier to upper camel case: `E`
warning: type parameter `e` should have an upper camel case name
--> code.rs:5:6
|
5 | impl<e> c for e where e: a<""> {}
| ^ help: convert the identifier to upper camel case: `E`
warning: type parameter `e` should have an upper camel case name
--> code.rs:6:6
|
6 | impl<e> c for d<e> {}
| ^ help: convert the identifier to upper camel case: `E`
warning: type parameter `e` should have an upper camel case name
--> code.rs:7:6
|
7 | impl<e> !a<f> for e {}
| ^ help: convert the identifier to upper camel case: `E`
Backtrace
thread 'rustc' panicked at /rustc/50aa04180709189a03dde5fd1c05751b2625ed37/compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs:37:13:
normalizing free const aliases in the type system is unsupported
stack backtrace:
0: 0x7cea90363923 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h35b8f72326f85230
1: 0x7cea90a05c07 - core::fmt::write::h73f5af0fa08ac030
2: 0x7cea91ae42d1 - std::io::Write::write_fmt::h0140e0dae4becf43
3: 0x7cea90363782 - std::sys::backtrace::BacktraceLock::print::h2c50f8265df4edf7
4: 0x7cea9036737a - std::panicking::default_hook::{{closure}}::h4f831a137f70e67f
5: 0x7cea90366eff - std::panicking::default_hook::h47af645a18677257
6: 0x7cea8f395ef3 - std[e444442488e5ea2d]::panicking::update_hook::<alloc[24374ce535a764d]::boxed::Box<rustc_driver_impl[d80da60e87609ad4]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7cea90367bf3 - std::panicking::rust_panic_with_hook::h2b8636e09e17cf97
8: 0x7cea903678b6 - std::panicking::begin_panic_handler::{{closure}}::h21b513d3b95c0c8c
9: 0x7cea90363de9 - std::sys::backtrace::__rust_end_short_backtrace::h1fff5f9fcecd2e0e
10: 0x7cea903675ad - __rustc[f67a3b4e60d8f4c4]::rust_begin_unwind
11: 0x7cea8cc85ce0 - core::panicking::panic_fmt::h0a5d5e7acfcd4e48
12: 0x7cea9164c0de - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
13: 0x7cea91646255 - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
14: 0x7cea9163ff90 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_goal_raw
15: 0x7cea9163a8ce - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_added_goals_step
16: 0x7cea9164ab8b - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
17: 0x7cea91646255 - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
18: 0x7cea9163ff90 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_goal_raw
19: 0x7cea9163a424 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_goal
20: 0x7cea9163a5cf - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_added_goals_step
21: 0x7cea9163b4c3 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_added_goals_and_make_canonical_response::{closure#0}
22: 0x7cea9165961d - <rustc_type_ir[9ff3c44187fc7187]::predicate::TraitPredicate<rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt> as rustc_next_trait_solver[18fca2b7321b89b5]::solve::assembly::GoalKind<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::consider_impl_candidate
23: 0x7cea91654dd8 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[9ff3c44187fc7187]::predicate::TraitPredicate<rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>
24: 0x7cea9164a6c5 - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
25: 0x7cea91646255 - <rustc_type_ir[9ff3c44187fc7187]::search_graph::SearchGraph<rustc_next_trait_solver[18fca2b7321b89b5]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate>, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
26: 0x7cea9163ff90 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_goal_raw
27: 0x7cea9163a424 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::evaluate_goal
28: 0x7cea91639eb1 - <rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate, rustc_middle[dca19e53efad7b1b]::ty::context::TyCtxt>>::enter_root::<core[ce1fa00964895ff1]::result::Result<(rustc_next_trait_solver[18fca2b7321b89b5]::solve::HasChanged, rustc_type_ir[9ff3c44187fc7187]::solve::Certainty), rustc_type_ir[9ff3c44187fc7187]::solve::NoSolution>, <rustc_trait_selection[d8f4687c93db682]::solve::delegate::SolverDelegate as rustc_next_trait_solver[18fca2b7321b89b5]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal::{closure#0}>
29: 0x7cea91b66e8d - <rustc_trait_selection[d8f4687c93db682]::solve::fulfill::FulfillmentCtxt<rustc_infer[9d37f22212116d89]::traits::engine::ScrubbedTraitError> as rustc_infer[9d37f22212116d89]::traits::engine::TraitEngine<rustc_infer[9d37f22212116d89]::traits::engine::ScrubbedTraitError>>::select_where_possible
30: 0x7cea91b66b1f - <rustc_trait_selection[d8f4687c93db682]::solve::fulfill::FulfillmentCtxt<rustc_infer[9d37f22212116d89]::traits::engine::ScrubbedTraitError> as rustc_infer[9d37f22212116d89]::traits::engine::TraitEngine<rustc_infer[9d37f22212116d89]::traits::engine::ScrubbedTraitError>>::select_all_or_error
31: 0x7cea901f402c - rustc_trait_selection[d8f4687c93db682]::traits::coherence::impl_intersection_has_negative_obligation
32: 0x7cea91644c10 - rustc_trait_selection[d8f4687c93db682]::traits::coherence::overlap
33: 0x7cea8d9940d4 - <rustc_middle[dca19e53efad7b1b]::traits::specialization_graph::Children as rustc_trait_selection[d8f4687c93db682]::traits::specialize::specialization_graph::ChildrenExt>::insert
34: 0x7cea90bc5ba3 - <rustc_middle[dca19e53efad7b1b]::traits::specialization_graph::Graph as rustc_trait_selection[d8f4687c93db682]::traits::specialize::specialization_graph::GraphExt>::insert
35: 0x7cea90bc74f3 - rustc_trait_selection[d8f4687c93db682]::traits::specialize::specialization_graph_provider
36: 0x7cea90bc6f0b - rustc_query_impl[d196c070bbe03594]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d196c070bbe03594]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 8usize]>>
37: 0x7cea90e3a77f - rustc_query_system[ff49814a586d4008]::query::plumbing::try_execute_query::<rustc_query_impl[d196c070bbe03594]::DynamicConfig<rustc_query_system[ff49814a586d4008]::query::caches::DefIdCache<rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d196c070bbe03594]::plumbing::QueryCtxt, false>
38: 0x7cea90ee3bf2 - rustc_query_impl[d196c070bbe03594]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
39: 0x7cea9123d9c1 - rustc_hir_analysis[e577ebb869d6e7c7]::coherence::coherent_trait
40: 0x7cea9123d67d - rustc_query_impl[d196c070bbe03594]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d196c070bbe03594]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>>
41: 0x7cea90f28552 - rustc_query_system[ff49814a586d4008]::query::plumbing::try_execute_query::<rustc_query_impl[d196c070bbe03594]::DynamicConfig<rustc_query_system[ff49814a586d4008]::query::caches::DefIdCache<rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d196c070bbe03594]::plumbing::QueryCtxt, false>
42: 0x7cea90f2719b - rustc_query_impl[d196c070bbe03594]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
43: 0x7cea9122bd10 - rustc_hir_analysis[e577ebb869d6e7c7]::check::wfcheck::check_well_formed
44: 0x7cea91229e4b - rustc_query_impl[d196c070bbe03594]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d196c070bbe03594]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>>
45: 0x7cea912296f1 - rustc_query_system[ff49814a586d4008]::query::plumbing::try_execute_query::<rustc_query_impl[d196c070bbe03594]::DynamicConfig<rustc_data_structures[c2151ea158282339]::vec_cache::VecCache<rustc_span[e6282e50b7a97c05]::def_id::LocalDefId, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[ff49814a586d4008]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[d196c070bbe03594]::plumbing::QueryCtxt, false>
46: 0x7cea912291e6 - rustc_query_impl[d196c070bbe03594]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
47: 0x7cea9122677d - rustc_hir_analysis[e577ebb869d6e7c7]::check::wfcheck::check_mod_type_wf
48: 0x7cea91226595 - rustc_query_impl[d196c070bbe03594]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d196c070bbe03594]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>>
49: 0x7cea919e7ac4 - rustc_query_system[ff49814a586d4008]::query::plumbing::try_execute_query::<rustc_query_impl[d196c070bbe03594]::DynamicConfig<rustc_query_system[ff49814a586d4008]::query::caches::DefaultCache<rustc_span[e6282e50b7a97c05]::def_id::LocalModDefId, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d196c070bbe03594]::plumbing::QueryCtxt, false>
50: 0x7cea919e7851 - rustc_query_impl[d196c070bbe03594]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
51: 0x7cea90da5ef2 - rustc_hir_analysis[e577ebb869d6e7c7]::check_crate
52: 0x7cea90d99237 - rustc_interface[4b2c44076e9c0aea]::passes::run_required_analyses
53: 0x7cea919e8ade - rustc_interface[4b2c44076e9c0aea]::passes::analysis
54: 0x7cea919e8ab5 - rustc_query_impl[d196c070bbe03594]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d196c070bbe03594]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 0usize]>>
55: 0x7cea9193ccfa - rustc_query_system[ff49814a586d4008]::query::plumbing::try_execute_query::<rustc_query_impl[d196c070bbe03594]::DynamicConfig<rustc_query_system[ff49814a586d4008]::query::caches::SingleCache<rustc_middle[dca19e53efad7b1b]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d196c070bbe03594]::plumbing::QueryCtxt, false>
56: 0x7cea9193c9cf - rustc_query_impl[d196c070bbe03594]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
57: 0x7cea91c34b87 - rustc_interface[4b2c44076e9c0aea]::passes::create_and_enter_global_ctxt::<core[ce1fa00964895ff1]::option::Option<rustc_interface[4b2c44076e9c0aea]::queries::Linker>, rustc_driver_impl[d80da60e87609ad4]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
58: 0x7cea91b0b5a6 - rustc_interface[4b2c44076e9c0aea]::interface::run_compiler::<(), rustc_driver_impl[d80da60e87609ad4]::run_compiler::{closure#0}>::{closure#1}
59: 0x7cea91adad7e - std[e444442488e5ea2d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4b2c44076e9c0aea]::util::run_in_thread_with_globals<rustc_interface[4b2c44076e9c0aea]::util::run_in_thread_pool_with_globals<rustc_interface[4b2c44076e9c0aea]::interface::run_compiler<(), rustc_driver_impl[d80da60e87609ad4]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
60: 0x7cea91adb1f4 - <<std[e444442488e5ea2d]::thread::Builder>::spawn_unchecked_<rustc_interface[4b2c44076e9c0aea]::util::run_in_thread_with_globals<rustc_interface[4b2c44076e9c0aea]::util::run_in_thread_pool_with_globals<rustc_interface[4b2c44076e9c0aea]::interface::run_compiler<(), rustc_driver_impl[d80da60e87609ad4]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ce1fa00964895ff1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
61: 0x7cea91adc5eb - std::sys::pal::unix::thread::Thread::new::thread_start::h8985427f793e6fe1
62: 0x7cea8b8a370a - <unknown>
63: 0x7cea8b927aac - <unknown>
64: 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 make sure that you have updated to the latest nightly
note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-05-09T16_14_43-991372.txt` to your bug report
query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `c`
#1 [coherent_trait] coherence checking all impls of trait `c`
#2 [check_well_formed] checking that `<impl at code.rs:5:1: 5:31>` 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: aborting due to 2 previous errors; 9 warnings emitted