Change:
<!-- [31mICE[0m: Rustc '--edition=2021 -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at ', 'thread 'rustc' panicked at ' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [typeopnormalizeclause] normalizing [mirborrowck] borrow-checking [typeofopaque] computing type of opaque [typeof] computing type of [checkwellformed] checking that is well-formed [checkmodtype_wf] checking that types are well-formed in top-level module [analysis] running analysis passes on this crate --

Discussion:
} let projection_ty = if let ty::AssocKind::Fn = assoc_kind { <del> let mut emitted_bad_param_err = false; </del> <ins> let mut emitted_bad_param_err = None; </ins> // If we have an method return type bound, then we need to substitute // the method's early bound params with suitable late-bound params. let mut num_bound_vars = candidate.bound_vars().len();

) .into(), ty::GenericParamDefKind::Type { .. } => { <del> if !emitted_bad_param_err { </del> <ins> let guar = *emitted_bad_param_err.get_or_insert_with(|| { </ins> tcx.dcx().emit_err( crate::errors::ReturnTypeNotationIllegalParam::Type { span: path_span, param_span: tcx.def_span(param.def_id), }, <del> ); emitted_bad_param_err = true; } Ty::new_bound( tcx, ty::INNERMOST, ty::BoundTy { var: ty::BoundVar::from_usize(num_bound_vars), kind: ty::BoundTyKind::Param(param.def_id, param.name), }, ) .into() </del> <ins> ) }); Ty::new_error(tcx, guar).into() </ins> } ty::GenericParamDefKind::Const { .. } => { <del> if !emitted_bad_param_err { </del> <ins> let guar = *emitted_bad_param_err.get_or_insert_with(|| { </ins> tcx.dcx().emit_err( crate::errors::ReturnTypeNotationIllegalParam::Const { span: path_span, param_span: tcx.def_span(param.def_id), }, <del> ); emitted_bad_param_err = true; } </del> <ins> ) }); </ins> let ty = tcx .type_of(param.def_id) .no_bound_vars() .expect("ct params cannot have early bound vars"); <del> ty::Const::new_bound( tcx, ty::INNERMOST, ty::BoundVar::from_usize(num_bound_vars), ty, ) .into() </del> <ins> ty::Const::new_error(tcx, guar, ty).into() </ins> } }; num_bound_vars += 1;

<ins> // edition: 2021 #![feature(return_type_notation)] //~^ WARN the feature `return_type_notation` is incomplete trait HealthCheck { async fn check<const N: usize>() -> bool; } async fn do_health_check_par<HC>(hc: HC) where HC: HealthCheck<check(): Send> + Send + 'static, //~^ ERROR return type notation is not allowed for functions that have const parameters { } fn main() {} </ins>

<ins> warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/issue-120208-higher-ranked-const.rs:3:12 | LL | #![feature(return_type_notation)] |            ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = note: `#[warn(incomplete_features)]` on by default error: return type notation is not allowed for functions that have const parameters --> $DIR/issue-120208-higher-ranked-const.rs:12:21 | LL |     async fn check<const N: usize>() -> bool; |                    -------------- const parameter declared here ... LL |     HC: HealthCheck<check(): Send> + Send + 'static, |                     ^^^^^^^^^^^^^ error: aborting due to 1 previous error; 1 warning emitted </ins>