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: unexpected const placeholder #131538

Closed
matthiaskrgr opened this issue Oct 11, 2024 · 6 comments
Closed

ICE: unexpected const placeholder #131538

matthiaskrgr opened this issue Oct 11, 2024 · 6 comments
Labels
A-GATs Area: Generic associated types (GATs) A-inference Area: Type inference A-trait-system Area: Trait system C-bug Category: This is a bug. F-generic_associated_types_extended `#![feature(generic_associated_types_extended)]` F-return_type_notation `#[feature(return_type_notation)]` F-trivial_bounds `#![feature(trivial_bounds)]` 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

Code

#![feature(return_type_notation)]
#![feature(generic_associated_types_extended)]
#![feature(trivial_bounds)]

trait HealthCheck {
    async fn check<const N: usize>() -> bool;
}

async fn do_health_check_par<HC>()
where
    HealthCheck: HealthCheck<Send(): Send> + Send + 'static,
{
}

Meta

rustc --version --verbose:

binary: rustc
commit-hash: 52fd9983996d9fcfb719749838336be66dee68f9
commit-date: 2024-10-10
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Error output

warning: the feature `generic_associated_types_extended` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/crash.rs:2:12
  |
2 | #![feature(generic_associated_types_extended)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #95451 <https://github.com/rust-lang/rust/issues/95451> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: parenthesized generic arguments cannot be used in associated type constraints
  --> /tmp/crash.rs:11:30
   |
11 |     HealthCheck: HealthCheck<Send(): Send> + Send + 'static,
   |                              ^^^^--
   |                                  |
   |                                  help: remove these parentheses

error[E0220]: associated type `Send` not found for `HealthCheck`
  --> /tmp/crash.rs:11:30
   |
11 |     HealthCheck: HealthCheck<Send(): Send> + Send + 'static,
   |                              ^^^^ associated type `Send` not found
Backtrace

error: internal compiler error: compiler/rustc_infer/src/infer/freshen.rs:178:17: unexpected const !130_0

thread 'rustc' panicked at compiler/rustc_infer/src/infer/freshen.rs:178:17:
Box<dyn Any>
stack backtrace:
   0:     0x7714989dd24a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h87acf85b5211808c
   1:     0x7714992034a6 - core::fmt::write::h1830300cff8013e6
   2:     0x77149a40bb91 - std::io::Write::write_fmt::hff4c51c59db7db45
   3:     0x7714989dd0a2 - std::sys::backtrace::BacktraceLock::print::h5e8429acc66fa0b4
   4:     0x7714989df576 - std::panicking::default_hook::{{closure}}::h47c5621b8a2933e4
   5:     0x7714989df3c0 - std::panicking::default_hook::h4c51255dc678cdff
   6:     0x771497a315df - std[39bba8b06d71f7a0]::panicking::update_hook::<alloc[c38a7ac3bd25a6f5]::boxed::Box<rustc_driver_impl[2b16dbb9274b0adb]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7714989dfc88 - std::panicking::rust_panic_with_hook::hfa48cfa9339c55df
   8:     0x771497a6b7c1 - std[39bba8b06d71f7a0]::panicking::begin_panic::<rustc_errors[f6e17c2fb5aa1767]::ExplicitBug>::{closure#0}
   9:     0x771497a5e866 - std[39bba8b06d71f7a0]::sys::backtrace::__rust_end_short_backtrace::<std[39bba8b06d71f7a0]::panicking::begin_panic<rustc_errors[f6e17c2fb5aa1767]::ExplicitBug>::{closure#0}, !>
  10:     0x771497a59d99 - std[39bba8b06d71f7a0]::panicking::begin_panic::<rustc_errors[f6e17c2fb5aa1767]::ExplicitBug>
  11:     0x771497a75051 - <rustc_errors[f6e17c2fb5aa1767]::diagnostic::BugAbort as rustc_errors[f6e17c2fb5aa1767]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7714980d1124 - rustc_middle[29f16e95e513605a]::util::bug::opt_span_bug_fmt::<rustc_span[6ca13cbf14de63a0]::span_encoding::Span>::{closure#0}
  13:     0x7714980b6f9a - rustc_middle[29f16e95e513605a]::ty::context::tls::with_opt::<rustc_middle[29f16e95e513605a]::util::bug::opt_span_bug_fmt<rustc_span[6ca13cbf14de63a0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7714980b6e2b - rustc_middle[29f16e95e513605a]::ty::context::tls::with_context_opt::<rustc_middle[29f16e95e513605a]::ty::context::tls::with_opt<rustc_middle[29f16e95e513605a]::util::bug::opt_span_bug_fmt<rustc_span[6ca13cbf14de63a0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7714955faad0 - rustc_middle[29f16e95e513605a]::util::bug::bug_fmt
  16:     0x771499f446fb - <rustc_infer[175fb04e3dbeac18]::infer::freshen::TypeFreshener as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_const
  17:     0x771499337449 - <rustc_middle[29f16e95e513605a]::ty::Ty as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeSuperFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[175fb04e3dbeac18]::infer::freshen::TypeFreshener>
  18:     0x771499e990c5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  19:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  20:     0x771499a89bea - rustc_trait_selection[51e218581841b494]::traits::project::poly_project_and_unify_term
  21:     0x771495defc36 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  22:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  23:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  24:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  25:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
  26:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
  27:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
  28:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
  29:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  30:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  31:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  32:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  33:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
  34:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
  35:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
  36:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
  37:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  38:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  39:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  40:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  41:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
  42:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
  43:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
  44:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
  45:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  46:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  47:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  48:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  49:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
  50:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
  51:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
  52:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
  53:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  54:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  55:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  56:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  57:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
  58:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
  59:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
  60:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
  61:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  62:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
  63:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
  64:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
  65:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>

<snip>

1010:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
1011:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
1012:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
1013:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
1014:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
1015:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
1016:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
1017:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
1018:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
1019:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
1020:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
1021:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
1022:     0x771499e9d1f5 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::poly_select::{closure#0}
1023:     0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
1024:     0x771499a915b3 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_ty
1025:     0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer>
1026:     0x771499a901e0 - <rustc_trait_selection[51e218581841b494]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFolder<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt>>::fold_predicate
1027:     0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::<rustc_middle[29f16e95e513605a]::ty::predicate::Clause>
1028:     0x771499aef3ae - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::confirm_candidate
1029:     0x771495decd8d - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
1030:     0x771495e1a435 - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::candidate_from_obligation
1031:     0x771499ab03bc - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
1032:     0x7714992e9c5e - <rustc_trait_selection[51e218581841b494]::traits::select::SelectionContext>::evaluate_root_obligation
1033:     0x7714992e8212 - rustc_traits[f9de722fbc0fac2a]::evaluate_obligation::evaluate_obligation
1034:     0x7714992e7ca9 - rustc_query_impl[577202e9d6ff7d36]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[577202e9d6ff7d36]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 2usize]>>
1035:     0x7714992e722b - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::<rustc_query_impl[577202e9d6ff7d36]::DynamicConfig<rustc_query_system[e421b998c28443f5]::query::caches::DefaultCache<rustc_type_ir[aeae2260a8e42b9a]::canonical::Canonical<rustc_middle[29f16e95e513605a]::ty::context::TyCtxt, rustc_middle[29f16e95e513605a]::ty::ParamEnvAnd<rustc_middle[29f16e95e513605a]::ty::predicate::Predicate>>, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[577202e9d6ff7d36]::plumbing::QueryCtxt, false>
1036:     0x7714992e6e7a - rustc_query_impl[577202e9d6ff7d36]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
1037:     0x77149569bcc7 - <rustc_trait_selection[51e218581841b494]::traits::fulfill::FulfillProcessor as rustc_data_structures[c6998ca21e3f6fd0]::obligation_forest::ObligationProcessor>::process_obligation
1038:     0x7714993f32c1 - <rustc_data_structures[c6998ca21e3f6fd0]::obligation_forest::ObligationForest<rustc_trait_selection[51e218581841b494]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[51e218581841b494]::traits::fulfill::FulfillProcessor>
1039:     0x7714993efcc1 - <rustc_trait_selection[51e218581841b494]::traits::engine::ObligationCtxt<rustc_trait_selection[51e218581841b494]::traits::FulfillmentError>>::assumed_wf_types_and_report_errors
1040:     0x7714999836f5 - rustc_hir_analysis[7d1658e465b44263]::check::wfcheck::check_item_fn
1041:     0x771496b5386f - rustc_hir_analysis[7d1658e465b44263]::check::wfcheck::check_well_formed
1042:     0x771499bd53eb - rustc_query_impl[577202e9d6ff7d36]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[577202e9d6ff7d36]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>
1043:     0x771499bd4b51 - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::<rustc_query_impl[577202e9d6ff7d36]::DynamicConfig<rustc_query_system[e421b998c28443f5]::query::caches::VecCache<rustc_span[6ca13cbf14de63a0]::def_id::LocalDefId, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[577202e9d6ff7d36]::plumbing::QueryCtxt, false>
1044:     0x771499bd47d0 - rustc_query_impl[577202e9d6ff7d36]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
1045:     0x771499bd567f - rustc_hir_analysis[7d1658e465b44263]::check::wfcheck::check_mod_type_wf
1046:     0x771499bd54a5 - rustc_query_impl[577202e9d6ff7d36]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[577202e9d6ff7d36]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>
1047:     0x77149a101d3b - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::<rustc_query_impl[577202e9d6ff7d36]::DynamicConfig<rustc_query_system[e421b998c28443f5]::query::caches::DefaultCache<rustc_span[6ca13cbf14de63a0]::def_id::LocalModDefId, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[577202e9d6ff7d36]::plumbing::QueryCtxt, false>
1048:     0x77149a101aed - rustc_query_impl[577202e9d6ff7d36]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
1049:     0x77149963387b - rustc_hir_analysis[7d1658e465b44263]::check_crate
1050:     0x7714996305d7 - rustc_interface[3d22ab4a16c914f1]::passes::run_required_analyses
1051:     0x771499f29a5e - rustc_interface[3d22ab4a16c914f1]::passes::analysis
1052:     0x771499f29a31 - rustc_query_impl[577202e9d6ff7d36]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[577202e9d6ff7d36]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>
1053:     0x77149a1138ae - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::<rustc_query_impl[577202e9d6ff7d36]::DynamicConfig<rustc_query_system[e421b998c28443f5]::query::caches::SingleCache<rustc_middle[29f16e95e513605a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[577202e9d6ff7d36]::plumbing::QueryCtxt, false>
1054:     0x77149a11358f - rustc_query_impl[577202e9d6ff7d36]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
1055:     0x771499f39a5e - rustc_interface[3d22ab4a16c914f1]::interface::run_compiler::<core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>, rustc_driver_impl[2b16dbb9274b0adb]::run_compiler::{closure#0}>::{closure#1}
1056:     0x771499fc1d50 - std[39bba8b06d71f7a0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3d22ab4a16c914f1]::util::run_in_thread_with_globals<rustc_interface[3d22ab4a16c914f1]::util::run_in_thread_pool_with_globals<rustc_interface[3d22ab4a16c914f1]::interface::run_compiler<core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>, rustc_driver_impl[2b16dbb9274b0adb]::run_compiler::{closure#0}>::{closure#1}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>::{closure#0}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>
1057:     0x771499fc2417 - <<std[39bba8b06d71f7a0]::thread::Builder>::spawn_unchecked_<rustc_interface[3d22ab4a16c914f1]::util::run_in_thread_with_globals<rustc_interface[3d22ab4a16c914f1]::util::run_in_thread_pool_with_globals<rustc_interface[3d22ab4a16c914f1]::interface::run_compiler<core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>, rustc_driver_impl[2b16dbb9274b0adb]::run_compiler::{closure#0}>::{closure#1}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>::{closure#0}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ae4016a0c652b3c]::result::Result<(), rustc_span[6ca13cbf14de63a0]::ErrorGuaranteed>>::{closure#1} as core[5ae4016a0c652b3c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
1058:     0x771499fc3301 - std::sys::pal::unix::thread::Thread::new::thread_start::hc0595517bea46b79
1059:     0x77149b80139d - <unknown>
1060:     0x77149b88649c - <unknown>
1061:                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/rustc-ice-2024-10-11T09_35_41-93078.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `(dyn HealthCheck + 'a): HealthCheck`
#1 [check_well_formed] checking that `do_health_check_par` is well-formed
end of query stack
error[E0782]: trait objects must include the `dyn` keyword
  --> /tmp/crash.rs:11:5
   |
11 |     HealthCheck: HealthCheck<Send(): Send> + Send + 'static,
   |     ^^^^^^^^^^^
   |
help: add `dyn` keyword before this trait
   |
11 |     dyn HealthCheck: HealthCheck<Send(): Send> + Send + 'static,
   |     +++

error: aborting due to 4 previous errors; 1 warning emitted

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

@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 Oct 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 11, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Oct 11, 2024

Reduced:

#![feature(generic_associated_types_extended)]
#![feature(trivial_bounds)]

trait HealthCheck {
    async fn check<const N: usize>();
}

fn do_health_check_par()
where
    HealthCheck: HealthCheck,
{
}

Removing #![feature(trivial_bounds)] causes the compiler to hang, instead of ICEing.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 15, 2024
@fmease fmease changed the title ICE: unexpected const ICE: unexpected const placeholder Oct 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 20, 2024
@szbergeron
Copy link

Hi All! Do we know what the expected behavior for this case should be?

As is, it runs into recursion limits and then bugs when TypeFreshener tries to fold a ConstKind::Placeholder left over afterwards.

My intuition is that it should behave exactly as it does when check is fn check<const N: usize>(); or fn check<const N: usize>(&self);: complain that HealthCheck is not object safe due to missing self or generic parameters and then exit gracefully.

Is this a reasonable/accurate assumption? (I'm new to reading rustc so my understanding may very well be off base!)

@workingjubilee workingjubilee added A-trait-system Area: Trait system A-inference Area: Type inference F-generic_associated_types_extended `#![feature(generic_associated_types_extended)]` F-return_type_notation `#[feature(return_type_notation)]` F-trivial_bounds `#![feature(trivial_bounds)]` labels Oct 21, 2024
@szbergeron
Copy link

szbergeron commented Oct 22, 2024

663da00 does change the behavior here for the current minified example, though I think there should still be a way of triggering the ICE now. I'll try to produce a new test that still exhibits the behavior after that.

EDIT: new repro that accommodates the changes:

#![feature(generic_associated_types_extended)]
#![feature(trivial_bounds)]

trait HealthCheck {
    async fn check<const N: usize>();
}

fn do_health_check_par()
where
    dyn HealthCheck: HealthCheck,
{
}

@szbergeron
Copy link

Additional experimentation to take out some red herrings, this also hangs rustc as when removing the trivial_bounds feature on the original issue:

#![feature(generic_associated_types_extended)]

trait U {
}

trait HealthCheck {
    fn check(&self) -> impl U;
}

fn do_health_check_par()
where
    dyn HealthCheck: HealthCheck,
{
}

The const param on check does force the ICE, but it continues to chase its own tail in binder for the trivial HealthCheck bound.

@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
@fmease
Copy link
Member

fmease commented Nov 6, 2024

Similar reproducers:

cc #132672 (comment)
cc #132672 (comment)

@fmease fmease removed the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Dec 7, 2024
@fmease
Copy link
Member

fmease commented Dec 7, 2024

The feature has been removed (#133768). Not reproducible without it.
The crash test has intentionally been removed.

@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) A-inference Area: Type inference A-trait-system Area: Trait system C-bug Category: This is a bug. F-generic_associated_types_extended `#![feature(generic_associated_types_extended)]` F-return_type_notation `#[feature(return_type_notation)]` F-trivial_bounds `#![feature(trivial_bounds)]` 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

7 participants