Repository: rust
Issue: ICE: `converted TraitPredicate` / ` invalid predicate filter for 'remap_gat_vars_and_recurse_into_nested_projections'`
Labels: I-ICE,T-compiler,C-bug,F-const_trait_impl,S-bug-has-test

<!--
[31mICE[0m: Rustc ./a.rs '' 'thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/item_bounds.rs:129:25: 'internal error: entered unreachable code: invalid predicate filter for `remap_gat_vars_and_recurse_into_nested_projections`'', 'thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/item_bounds.rs:129:25: 'internal error: entered unreachable code: invalid predicate filter for `remap_gat_vars_and_recurse_into_nested_projections`''
File: /tmp/im/a.rs
-->

auto-reduced (treereduce-rust):
````rust
#[const_trait]
trait Foo3<T>
where
    Self::Bar: Clone,
    Self::Baz: Clone,
{
    type Baz = T;
}

````

original:
````rust
//@ check-pass
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl)]

#[const_trait]
pub trait Owo<X = <IntEnum as Uwu>::T> {}

#[const_trait]
trait Foo3<T>
where
    Self::Bar: Clone,
    Self::Baz: Clone,
{
    type Bar = Vec<Self::Baz>;
    type Baz = T;
    //~^ ERROR the trait bound `T: Clone` is not satisfied
}

````

Version information
````
rustc 1.84.0-nightly (2d0ea7956 2024-11-20)
binary: rustc
commit-hash: 2d0ea7956c45de6e421fd579e2ded27be405dec6
commit-date: 2024-11-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

````

Possibly related line of code:
https://github.com/rust-lang/rust/blob/2d0ea7956c45de6e421fd579e2ded27be405dec6/compiler/rustc_hir_analysis/src/collect/predicates_of.rs#L1045-L1057

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

<details><summary><strong>Program output</strong></summary>
<p>

```
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
 --> /tmp/icemaker_global_tempdir.3JnExAaPPyjX/rustc_testrunner_tmpdir_reporting.6QTzPvkyMQg2/mvce.rs:1:1
  |
1 | #[const_trait]
  | ^^^^^^^^^^^^^^
  |
  = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
  = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-20; consider upgrading it if it is out of date

error[E0658]: associated type defaults are unstable
 --> /tmp/icemaker_global_tempdir.3JnExAaPPyjX/rustc_testrunner_tmpdir_reporting.6QTzPvkyMQg2/mvce.rs:7:5
  |
7 |     type Baz = T;
  |     ^^^^^^^^^^^^^
  |
  = note: see issue #29661 <https://github.com/rust-lang/rust/issues/29661> for more information
  = help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-20; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.3JnExAaPPyjX/rustc_testrunner_tmpdir_reporting.6QTzPvkyMQg2/mvce.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.3JnExAaPPyjX/rustc_testrunner_tmpdir_reporting.6QTzPvkyMQg2/mvce.rs`

error[E0220]: associated type `Bar` not found for `Self`
 --> /tmp/icemaker_global_tempdir.3JnExAaPPyjX/rustc_testrunner_tmpdir_reporting.6QTzPvkyMQg2/mvce.rs:4:11
  |
4 |     Self::Bar: Clone,
  |           ^^^ help: there is an associated type with a similar name: `Baz`

error: internal compiler error: compiler/rustc_hir_analysis/src/collect/predicates_of.rs:1051:26: converted TraitPredicate(<<Self as Foo3<T>>::Baz as std::clone::Clone>, polarity:Positive)

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/predicates_of.rs:1051:26:
Box<dyn Any>
stack backtrace:
   0:     0x7ca0476734fa - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h047e0d5e47450165
   1:     0x7ca047e24fe2 - core::fmt::write::h02224197acc1c478
   2:     0x7ca049283b11 - std::io::Write::write_fmt::haf49afba339ba238
   3:     0x7ca047673352 - std::sys::backtrace::BacktraceLock::print::hb9734e16f0c36e6c
   4:     0x7ca04767582a - std::panicking::default_hook::{{closure}}::h1a248142e8880b97
   5:     0x7ca047675690 - std::panicking::default_hook::h922c0a7f60dece2a
   6:     0x7ca0466faa65 - std[a682ed40c8c5f211]::panicking::update_hook::<alloc[b6fe8004693423c5]::boxed::Box<rustc_driver_impl[ccb010d605d21fce]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7ca047675f08 - std::panicking::rust_panic_with_hook::h7c200c3622363a4f
   8:     0x7ca046734901 - std[a682ed40c8c5f211]::panicking::begin_panic::<rustc_errors[1430c921f1781f5b]::ExplicitBug>::{closure#0}
   9:     0x7ca0467278c6 - std[a682ed40c8c5f211]::sys::backtrace::__rust_end_short_backtrace::<std[a682ed40c8c5f211]::panicking::begin_panic<rustc_errors[1430c921f1781f5b]::ExplicitBug>::{closure#0}, !>
  10:     0x7ca046722e99 - std[a682ed40c8c5f211]::panicking::begin_panic::<rustc_errors[1430c921f1781f5b]::ExplicitBug>
  11:     0x7ca04673e831 - <rustc_errors[1430c921f1781f5b]::diagnostic::BugAbort as rustc_errors[1430c921f1781f5b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7ca046db2873 - rustc_middle[ab7e7e2c8044b8bd]::util::bug::opt_span_bug_fmt::<rustc_span[7ad9000666f00a6a]::span_encoding::Span>::{closure#0}
  13:     0x7ca046d99e2a - rustc_middle[ab7e7e2c8044b8bd]::ty::context::tls::with_opt::<rustc_middle[ab7e7e2c8044b8bd]::util::bug::opt_span_bug_fmt<rustc_span[7ad9000666f00a6a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7ca046d99cbb - rustc_middle[ab7e7e2c8044b8bd]::ty::context::tls::with_context_opt::<rustc_middle[ab7e7e2c8044b8bd]::ty::context::tls::with_opt<rustc_middle[ab7e7e2c8044b8bd]::util::bug::opt_span_bug_fmt<rustc_span[7ad9000666f00a6a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7ca044eeefd0 - rustc_middle[ab7e7e2c8044b8bd]::util::bug::bug_fmt
  16:     0x7ca0468f20d6 - rustc_hir_analysis[1b3d93177a6f01f5]::collect::predicates_of::implied_const_bounds
  17:     0x7ca0471a1237 - rustc_query_impl[816e84f5405d42e3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[816e84f5405d42e3]::query_impl::implied_const_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 16usize]>>
  18:     0x7ca04717ea09 - <rustc_query_impl[816e84f5405d42e3]::query_impl::implied_const_bounds::dynamic_query::{closure#2} as core[d4b455c786e6b169]::ops::function::FnOnce<(rustc_middle[ab7e7e2c8044b8bd]::ty::context::TyCtxt, rustc_span[7ad9000666f00a6a]::def_id::DefId)>>::call_once
  19:     0x7ca04801195a - rustc_query_system[6d3fbfb79102f8b4]::query::plumbing::try_execute_query::<rustc_query_impl[816e84f5405d42e3]::DynamicConfig<rustc_query_system[6d3fbfb79102f8b4]::query::caches::DefIdCache<rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[816e84f5405d42e3]::plumbing::QueryCtxt, false>
  20:     0x7ca0471ad3a0 - rustc_query_impl[816e84f5405d42e3]::query_impl::implied_const_bounds::get_query_non_incr::__rust_end_short_backtrace
  21:     0x7ca04800f34d - rustc_middle[ab7e7e2c8044b8bd]::query::plumbing::query_get_at::<rustc_query_system[6d3fbfb79102f8b4]::query::caches::DefIdCache<rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 16usize]>>>
  22:     0x7ca04690494f - rustc_hir_analysis[1b3d93177a6f01f5]::check::compare_impl_item::check_type_bounds
  23:     0x7ca048ff035f - rustc_hir_analysis[1b3d93177a6f01f5]::check::check::check_item_type
  24:     0x7ca044d52c12 - rustc_hir_analysis[1b3d93177a6f01f5]::check::wfcheck::check_well_formed
  25:     0x7ca0486fea67 - rustc_query_impl[816e84f5405d42e3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[816e84f5405d42e3]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7ca0486fed40 - rustc_query_system[6d3fbfb79102f8b4]::query::plumbing::try_execute_query::<rustc_query_impl[816e84f5405d42e3]::DynamicConfig<rustc_data_structures[5bd100dcdab3ae53]::vec_cache::VecCache<rustc_span[7ad9000666f00a6a]::def_id::LocalDefId, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[6d3fbfb79102f8b4]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[816e84f5405d42e3]::plumbing::QueryCtxt, false>
  27:     0x7ca0486fea46 - rustc_query_impl[816e84f5405d42e3]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7ca0486ff7ec - rustc_hir_analysis[1b3d93177a6f01f5]::check::wfcheck::check_mod_type_wf
  29:     0x7ca0486ff60b - rustc_query_impl[816e84f5405d42e3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[816e84f5405d42e3]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7ca0489a273d - rustc_query_system[6d3fbfb79102f8b4]::query::plumbing::try_execute_query::<rustc_query_impl[816e84f5405d42e3]::DynamicConfig<rustc_query_system[6d3fbfb79102f8b4]::query::caches::DefaultCache<rustc_span[7ad9000666f00a6a]::def_id::LocalModDefId, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[816e84f5405d42e3]::plumbing::QueryCtxt, false>
  31:     0x7ca0489a24d8 - rustc_query_impl[816e84f5405d42e3]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7ca0480504a4 - rustc_hir_analysis[1b3d93177a6f01f5]::check_crate
  33:     0x7ca04866eb4a - rustc_interface[36be2150eace64c8]::passes::run_required_analyses
  34:     0x7ca048662ede - rustc_interface[36be2150eace64c8]::passes::analysis
  35:     0x7ca048662eaf - rustc_query_impl[816e84f5405d42e3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[816e84f5405d42e3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7ca048dde12e - rustc_query_system[6d3fbfb79102f8b4]::query::plumbing::try_execute_query::<rustc_query_impl[816e84f5405d42e3]::DynamicConfig<rustc_query_system[6d3fbfb79102f8b4]::query::caches::SingleCache<rustc_middle[ab7e7e2c8044b8bd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[816e84f5405d42e3]::plumbing::QueryCtxt, false>
  37:     0x7ca048ddde0e - rustc_query_impl[816e84f5405d42e3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7ca048d06480 - rustc_interface[36be2150eace64c8]::interface::run_compiler::<core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>, rustc_driver_impl[ccb010d605d21fce]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7ca048d4f5e0 - std[a682ed40c8c5f211]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[36be2150eace64c8]::util::run_in_thread_with_globals<rustc_interface[36be2150eace64c8]::util::run_in_thread_pool_with_globals<rustc_interface[36be2150eace64c8]::interface::run_compiler<core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>, rustc_driver_impl[ccb010d605d21fce]::run_compiler::{closure#0}>::{closure#1}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>::{closure#0}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>
  40:     0x7ca048d4f2fd - <<std[a682ed40c8c5f211]::thread::Builder>::spawn_unchecked_<rustc_interface[36be2150eace64c8]::util::run_in_thread_with_globals<rustc_interface[36be2150eace64c8]::util::run_in_thread_pool_with_globals<rustc_interface[36be2150eace64c8]::interface::run_compiler<core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>, rustc_driver_impl[ccb010d605d21fce]::run_compiler::{closure#0}>::{closure#1}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>::{closure#0}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d4b455c786e6b169]::result::Result<(), rustc_span[7ad9000666f00a6a]::ErrorGuaranteed>>::{closure#1} as core[d4b455c786e6b169]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7ca048d4eab9 - std::sys::pal::unix::thread::Thread::new::thread_start::h6a08e28522cda876
  42:     0x7ca04a61439d - <unknown>
  43:     0x7ca04a69949c - <unknown>
  44:                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.84.0-nightly (2d0ea7956 2024-11-20) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [implied_const_bounds] computing the implied `~const` bounds for `Foo3::Baz`
#1 [check_well_formed] checking that `Foo3` is well-formed
end of query stack
error: aborting due to 5 previous errors

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

```

</p>
</details>

<!--
query stack:
#0 [implied_const_bounds] computing the implied `~const` bounds for `Foo3::Baz`
#1 [check_well_formed] checking that `Foo3` is well-formed

-->
@rustbot label +F-const_trait_impl