Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: converted TraitPredicate / invalid predicate filter for 'remap_gat_vars_and_recurse_into_nested_projections' #133275

Open
matthiaskrgr opened this issue Nov 21, 2024 · 2 comments
Assignees
Labels
C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#[const_trait]
trait Foo3<T>
where
    Self::Bar: Clone,
    Self::Baz: Clone,
{
    type Baz = T;
}

original:

//@ 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:

(
clause.kind().map_bound(|clause| match clause {
ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
trait_ref,
constness: ty::BoundConstness::Maybe,
}) => trait_ref,
_ => bug!("converted {clause:?}"),
}),
span,
)
}))
})
}

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

Program output

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`.

@rustbot label +F-const_trait_impl

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 21, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-const_trait_impl `#![feature(const_trait_impl)]` labels Nov 21, 2024
@matthiaskrgr
Copy link
Member Author

The original code

#![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
}

ICEs with

Backtrace

error[E0405]: cannot find trait `Uwu` in this scope
 --> orig.rs:4:31
  |
4 | pub trait Owo<X = <IntEnum as Uwu>::T> {}
  |                               ^^^ not found in this scope

error[E0412]: cannot find type `IntEnum` in this scope
 --> orig.rs:4:20
  |
4 | pub trait Owo<X = <IntEnum as Uwu>::T> {}
  |                    ^^^^^^^ not found in this scope

error[E0658]: associated type defaults are unstable
  --> orig.rs:12:5
   |
12 |     type Bar = Vec<Self::Baz>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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[E0658]: associated type defaults are unstable
  --> orig.rs:13:5
   |
13 |     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 `orig`
  --> orig.rs:15:2
   |
15 | }
   |  ^ consider adding a `main` function to `orig.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`
stack backtrace:
   0:     0x73e3e5675eca - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h462aecd04ea9579e
   1:     0x73e3e5e23362 - core::fmt::write::h90ee43f9ea3cba58
   2:     0x73e3e727d091 - std::io::Write::write_fmt::hedeb5e5db4a69c5c
   3:     0x73e3e5675d22 - std::sys::backtrace::BacktraceLock::print::h4cd84f50718730a5
   4:     0x73e3e56781fa - std::panicking::default_hook::{{closure}}::hd4c3e895ac68f35a
   5:     0x73e3e5678060 - std::panicking::default_hook::h63638a03e198d592
   6:     0x73e3e46fbc25 - std[2244cad2f80807fb]::panicking::update_hook::<alloc[cbefbba4106c24e6]::boxed::Box<rustc_driver_impl[a02cca374e721ba2]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x73e3e56788d8 - std::panicking::rust_panic_with_hook::hb612322ec5da5d64
   8:     0x73e3e5678676 - std::panicking::begin_panic_handler::{{closure}}::h6feb9c17e822e11c
   9:     0x73e3e5676379 - std::sys::backtrace::__rust_end_short_backtrace::h8e3ef58fad0e2ac6
  10:     0x73e3e567836c - rust_begin_unwind
  11:     0x73e3e20e8e80 - core::panicking::panic_fmt::ha3834e2e112a488f
  12:     0x73e3e6de4028 - <core[f62530bb87197118]::iter::adapters::chain::Chain<core[f62530bb87197118]::iter::adapters::cloned::Cloned<core[f62530bb87197118]::slice::iter::Iter<(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span)>>, core[f62530bb87197118]::iter::adapters::filter_map::FilterMap<core[f62530bb87197118]::iter::adapters::copied::Copied<core[f62530bb87197118]::slice::iter::Iter<(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span)>>, rustc_hir_analysis[e809e52cab79a420]::collect::item_bounds::associated_type_bounds::{closure#0}>> as core[f62530bb87197118]::iter::traits::iterator::Iterator>::next
  13:     0x73e3e6de3b4b - rustc_arena[8bfd666bf8d1fd32]::outline::<<rustc_arena[8bfd666bf8d1fd32]::DroplessArena>::alloc_from_iter<(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span), core[f62530bb87197118]::iter::adapters::chain::Chain<core[f62530bb87197118]::iter::adapters::cloned::Cloned<core[f62530bb87197118]::slice::iter::Iter<(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span)>>, core[f62530bb87197118]::iter::adapters::filter_map::FilterMap<core[f62530bb87197118]::iter::adapters::copied::Copied<core[f62530bb87197118]::slice::iter::Iter<(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span)>>, rustc_hir_analysis[e809e52cab79a420]::collect::item_bounds::associated_type_bounds::{closure#0}>>>::{closure#0}, &mut [(rustc_middle[65a7c84fae00e80e]::ty::predicate::Clause, rustc_span[17c8ace98e68264b]::span_encoding::Span)]>
  14:     0x73e3e6de380d - rustc_hir_analysis[e809e52cab79a420]::collect::item_bounds::associated_type_bounds
  15:     0x73e3e6de2e24 - rustc_hir_analysis[e809e52cab79a420]::collect::item_bounds::explicit_item_bounds_with_filter
  16:     0x73e3e48f3b9d - rustc_hir_analysis[e809e52cab79a420]::collect::predicates_of::implied_const_bounds
  17:     0x73e3e51a31e7 - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>
  18:     0x73e3e51809a9 - <rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::dynamic_query::{closure#2} as core[f62530bb87197118]::ops::function::FnOnce<(rustc_middle[65a7c84fae00e80e]::ty::context::TyCtxt, rustc_span[17c8ace98e68264b]::def_id::DefId)>>::call_once
  19:     0x73e3e601155a - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::DefIdCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  20:     0x73e3e51af350 - rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::get_query_non_incr::__rust_end_short_backtrace
  21:     0x73e3e600ef4d - rustc_middle[65a7c84fae00e80e]::query::plumbing::query_get_at::<rustc_query_system[37669824fe84eed8]::query::caches::DefIdCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>>
  22:     0x73e3e4906631 - rustc_hir_analysis[e809e52cab79a420]::check::compare_impl_item::check_type_bounds
  23:     0x73e3e6fe806e - rustc_hir_analysis[e809e52cab79a420]::check::check::check_item_type
  24:     0x73e3e2d524e2 - rustc_hir_analysis[e809e52cab79a420]::check::wfcheck::check_well_formed
  25:     0x73e3e67076a7 - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  26:     0x73e3e6707980 - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_data_structures[96b571447b56927a]::vec_cache::VecCache<rustc_span[17c8ace98e68264b]::def_id::LocalDefId, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[37669824fe84eed8]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  27:     0x73e3e6707686 - rustc_query_impl[6938d1d3b9759c59]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x73e3e670842c - rustc_hir_analysis[e809e52cab79a420]::check::wfcheck::check_mod_type_wf
  29:     0x73e3e670824b - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  30:     0x73e3e6994d7d - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::DefaultCache<rustc_span[17c8ace98e68264b]::def_id::LocalModDefId, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  31:     0x73e3e6994b18 - rustc_query_impl[6938d1d3b9759c59]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x73e3e6050064 - rustc_hir_analysis[e809e52cab79a420]::check_crate
  33:     0x73e3e669520a - rustc_interface[c2b60ea3c5f8ab84]::passes::run_required_analyses
  34:     0x73e3e668945e - rustc_interface[c2b60ea3c5f8ab84]::passes::analysis
  35:     0x73e3e668942f - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  36:     0x73e3e6de8d6e - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::SingleCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  37:     0x73e3e6de8a4e - rustc_query_impl[6938d1d3b9759c59]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x73e3e6d10280 - rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler::<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}
  39:     0x73e3e6d401e0 - std[2244cad2f80807fb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>
  40:     0x73e3e6d3fefd - <<std[2244cad2f80807fb]::thread::Builder>::spawn_unchecked_<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#1} as core[f62530bb87197118]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x73e3e6d3f6b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hbfb59c93227878ea
  42:     0x73e3e856939d - <unknown>
  43:     0x73e3e85ee49c - <unknown>
  44:                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 `/tmp/im/rustc-ice-2024-11-21T02_05_11-1970818.txt` to your bug report

note: compiler flags: -Z next-solver=globally

query stack during panic:
#0 [implied_const_bounds] computing the implied `~const` bounds for `Foo3::Bar`
#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: E0405, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0405`.

, the autoreduced code

#[const_trait]
trait Foo3<T>
where
    Self::Bar: Clone,
    Self::Baz: Clone,
{
    type Bar = Vec<Self::Baz>;
}

ICEs with

Backtrace

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.
 --> auto.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
 --> auto.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 `auto`
 --> auto.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `auto.rs`

error[E0220]: associated type `Bar` not found for `Self`
 --> auto.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:     0x732fdce75eca - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h462aecd04ea9579e
   1:     0x732fdd623362 - core::fmt::write::h90ee43f9ea3cba58
   2:     0x732fdea7d091 - std::io::Write::write_fmt::hedeb5e5db4a69c5c
   3:     0x732fdce75d22 - std::sys::backtrace::BacktraceLock::print::h4cd84f50718730a5
   4:     0x732fdce781fa - std::panicking::default_hook::{{closure}}::hd4c3e895ac68f35a
   5:     0x732fdce78060 - std::panicking::default_hook::h63638a03e198d592
   6:     0x732fdbefbc25 - std[2244cad2f80807fb]::panicking::update_hook::<alloc[cbefbba4106c24e6]::boxed::Box<rustc_driver_impl[a02cca374e721ba2]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x732fdce788d8 - std::panicking::rust_panic_with_hook::hb612322ec5da5d64
   8:     0x732fdbf362a1 - std[2244cad2f80807fb]::panicking::begin_panic::<rustc_errors[f9771b9e181d5533]::ExplicitBug>::{closure#0}
   9:     0x732fdbf29266 - std[2244cad2f80807fb]::sys::backtrace::__rust_end_short_backtrace::<std[2244cad2f80807fb]::panicking::begin_panic<rustc_errors[f9771b9e181d5533]::ExplicitBug>::{closure#0}, !>
  10:     0x732fdbf24839 - std[2244cad2f80807fb]::panicking::begin_panic::<rustc_errors[f9771b9e181d5533]::ExplicitBug>
  11:     0x732fdbf401d1 - <rustc_errors[f9771b9e181d5533]::diagnostic::BugAbort as rustc_errors[f9771b9e181d5533]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x732fdc5b5143 - rustc_middle[65a7c84fae00e80e]::util::bug::opt_span_bug_fmt::<rustc_span[17c8ace98e68264b]::span_encoding::Span>::{closure#0}
  13:     0x732fdc59c5ea - rustc_middle[65a7c84fae00e80e]::ty::context::tls::with_opt::<rustc_middle[65a7c84fae00e80e]::util::bug::opt_span_bug_fmt<rustc_span[17c8ace98e68264b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x732fdc59c47b - rustc_middle[65a7c84fae00e80e]::ty::context::tls::with_context_opt::<rustc_middle[65a7c84fae00e80e]::ty::context::tls::with_opt<rustc_middle[65a7c84fae00e80e]::util::bug::opt_span_bug_fmt<rustc_span[17c8ace98e68264b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x732fda6eedf0 - rustc_middle[65a7c84fae00e80e]::util::bug::bug_fmt
  16:     0x732fdc0f3db6 - rustc_hir_analysis[e809e52cab79a420]::collect::predicates_of::implied_const_bounds
  17:     0x732fdc9a31e7 - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>
  18:     0x732fdc9809a9 - <rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::dynamic_query::{closure#2} as core[f62530bb87197118]::ops::function::FnOnce<(rustc_middle[65a7c84fae00e80e]::ty::context::TyCtxt, rustc_span[17c8ace98e68264b]::def_id::DefId)>>::call_once
  19:     0x732fdd81155a - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::DefIdCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  20:     0x732fdc9af350 - rustc_query_impl[6938d1d3b9759c59]::query_impl::implied_const_bounds::get_query_non_incr::__rust_end_short_backtrace
  21:     0x732fdd80ef4d - rustc_middle[65a7c84fae00e80e]::query::plumbing::query_get_at::<rustc_query_system[37669824fe84eed8]::query::caches::DefIdCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>>
  22:     0x732fdc106631 - rustc_hir_analysis[e809e52cab79a420]::check::compare_impl_item::check_type_bounds
  23:     0x732fde7e806e - rustc_hir_analysis[e809e52cab79a420]::check::check::check_item_type
  24:     0x732fda5524e2 - rustc_hir_analysis[e809e52cab79a420]::check::wfcheck::check_well_formed
  25:     0x732fddf076a7 - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  26:     0x732fddf07980 - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_data_structures[96b571447b56927a]::vec_cache::VecCache<rustc_span[17c8ace98e68264b]::def_id::LocalDefId, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[37669824fe84eed8]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  27:     0x732fddf07686 - rustc_query_impl[6938d1d3b9759c59]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x732fddf0842c - rustc_hir_analysis[e809e52cab79a420]::check::wfcheck::check_mod_type_wf
  29:     0x732fddf0824b - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  30:     0x732fde194d7d - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::DefaultCache<rustc_span[17c8ace98e68264b]::def_id::LocalModDefId, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  31:     0x732fde194b18 - rustc_query_impl[6938d1d3b9759c59]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x732fdd850064 - rustc_hir_analysis[e809e52cab79a420]::check_crate
  33:     0x732fdde9520a - rustc_interface[c2b60ea3c5f8ab84]::passes::run_required_analyses
  34:     0x732fdde8945e - rustc_interface[c2b60ea3c5f8ab84]::passes::analysis
  35:     0x732fdde8942f - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>
  36:     0x732fde5e8d6e - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::SingleCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
  37:     0x732fde5e8a4e - rustc_query_impl[6938d1d3b9759c59]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x732fde510280 - rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler::<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}
  39:     0x732fde5401e0 - std[2244cad2f80807fb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>
  40:     0x732fde53fefd - <<std[2244cad2f80807fb]::thread::Builder>::spawn_unchecked_<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#1} as core[f62530bb87197118]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x732fde53f6b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hbfb59c93227878ea
  42:     0x732fdfd5f39d - <unknown>
  43:     0x732fdfde449c - <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: please attach the file at `/tmp/im/rustc-ice-2024-11-21T02_10_46-1972052.txt` to your bug report

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`.

in both cases next-solver didn't seem to make a difference 🤔

code example that does not show any diagnostics, only ICE:

#![feature(const_trait_impl)]
#![feature(associated_type_defaults)]

#[const_trait]
trait Foo3<T>
where
    Self::Baz: Clone,
{
    type Baz = T;
}

pub fn main() {}

@matthiaskrgr matthiaskrgr added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 21, 2024
@compiler-errors compiler-errors self-assigned this Nov 21, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 21, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #131985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants