Open matthiaskrgr opened 1 week ago
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.
Hi All! Do we know what the expected behavior for this case should be?
As is, it runs into recursion limits and then bug
s 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!)
663da008760a0f6d38dbd5e7db4c9bb67fa64798 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,
{
}
Code
Meta
rustc --version --verbose
:Error output
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
stack backtrace:
0: 0x7714989dd24a - ::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::>::{closure#0}
7: 0x7714989dfc88 - std::panicking::rust_panic_with_hook::hfa48cfa9339c55df
8: 0x771497a6b7c1 - std[39bba8b06d71f7a0]::panicking::begin_panic::::{closure#0}
9: 0x771497a5e866 - std[39bba8b06d71f7a0]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
10: 0x771497a59d99 - std[39bba8b06d71f7a0]::panicking::begin_panic::
11: 0x771497a75051 - ::emit_producing_guarantee
12: 0x7714980d1124 - rustc_middle[29f16e95e513605a]::util::bug::opt_span_bug_fmt::::{closure#0}
13: 0x7714980b6f9a - rustc_middle[29f16e95e513605a]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
14: 0x7714980b6e2b - rustc_middle[29f16e95e513605a]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
15: 0x7714955faad0 - rustc_middle[29f16e95e513605a]::util::bug::bug_fmt
16: 0x771499f446fb - >::fold_const
17: 0x771499337449 - >::try_super_fold_with::
18: 0x771499e990c5 - ::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 - ::candidate_from_obligation_no_cache
22: 0x771499e9d1f5 - ::poly_select::{closure#0}
23: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
24: 0x771499a915b3 - >::fold_ty
25: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
26: 0x771499a901e0 - >::fold_predicate
27: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
28: 0x771499aef3ae - ::confirm_candidate
29: 0x771495decd8d - ::candidate_from_obligation_no_cache
30: 0x771499e9d1f5 - ::poly_select::{closure#0}
31: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
32: 0x771499a915b3 - >::fold_ty
33: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
34: 0x771499a901e0 - >::fold_predicate
35: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
36: 0x771499aef3ae - ::confirm_candidate
37: 0x771495decd8d - ::candidate_from_obligation_no_cache
38: 0x771499e9d1f5 - ::poly_select::{closure#0}
39: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
40: 0x771499a915b3 - >::fold_ty
41: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
42: 0x771499a901e0 - >::fold_predicate
43: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
44: 0x771499aef3ae - ::confirm_candidate
45: 0x771495decd8d - ::candidate_from_obligation_no_cache
46: 0x771499e9d1f5 - ::poly_select::{closure#0}
47: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
48: 0x771499a915b3 - >::fold_ty
49: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
50: 0x771499a901e0 - >::fold_predicate
51: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
52: 0x771499aef3ae - ::confirm_candidate
53: 0x771495decd8d - ::candidate_from_obligation_no_cache
54: 0x771499e9d1f5 - ::poly_select::{closure#0}
55: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
56: 0x771499a915b3 - >::fold_ty
57: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
58: 0x771499a901e0 - >::fold_predicate
59: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
60: 0x771499aef3ae - ::confirm_candidate
61: 0x771495decd8d - ::candidate_from_obligation_no_cache
62: 0x771499e9d1f5 - ::poly_select::{closure#0}
63: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
64: 0x771499a915b3 - >::fold_ty
65: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
1010: 0x771499a901e0 - >::fold_predicate
1011: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
1012: 0x771499aef3ae - ::confirm_candidate
1013: 0x771495decd8d - ::candidate_from_obligation_no_cache
1014: 0x771499e9d1f5 - ::poly_select::{closure#0}
1015: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
1016: 0x771499a915b3 - >::fold_ty
1017: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
1018: 0x771499a901e0 - >::fold_predicate
1019: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
1020: 0x771499aef3ae - ::confirm_candidate
1021: 0x771495decd8d - ::candidate_from_obligation_no_cache
1022: 0x771499e9d1f5 - ::poly_select::{closure#0}
1023: 0x771499a94890 - rustc_trait_selection[51e218581841b494]::traits::project::opt_normalize_projection_term
1024: 0x771499a915b3 - >::fold_ty
1025: 0x771499a909c1 - <&rustc_middle[29f16e95e513605a]::ty::list::RawList<(), rustc_middle[29f16e95e513605a]::ty::generic_args::GenericArg> as rustc_type_ir[aeae2260a8e42b9a]::fold::TypeFoldable>::try_fold_with::
1026: 0x771499a901e0 - >::fold_predicate
1027: 0x77149999fd89 - rustc_trait_selection[51e218581841b494]::traits::normalize::normalize_with_depth_to::
1028: 0x771499aef3ae - ::confirm_candidate
1029: 0x771495decd8d - ::candidate_from_obligation_no_cache
1030: 0x771495e1a435 - ::candidate_from_obligation
1031: 0x771499ab03bc - ::evaluate_trait_predicate_recursively
1032: 0x7714992e9c5e - ::evaluate_root_obligation
1033: 0x7714992e8212 - rustc_traits[f9de722fbc0fac2a]::evaluate_obligation::evaluate_obligation
1034: 0x7714992e7ca9 - rustc_query_impl[577202e9d6ff7d36]::plumbing::__rust_begin_short_backtrace::>
1035: 0x7714992e722b - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::>, 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 - ::process_obligation
1038: 0x7714993f32c1 - >::process_obligations::
1039: 0x7714993efcc1 - >::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::>
1043: 0x771499bd4b51 - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::>, 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::>
1047: 0x77149a101d3b - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::>, 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::>
1053: 0x77149a1138ae - rustc_query_system[e421b998c28443f5]::query::plumbing::try_execute_query::>, 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::, rustc_driver_impl[2b16dbb9274b0adb]::run_compiler::{closure#0}>::{closure#1}
1056: 0x771499fc1d50 - std[39bba8b06d71f7a0]::sys::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 -
1060: 0x77149b88649c -
1061: 0x0 -
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 + 'static,
| ^^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
11 | dyn HealthCheck: HealthCheck + 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`.
```