Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
searched nightlies: from nightly-2022-12-30 to nightly-2023-03-18 regressed nightly: nightly-2023-01-01 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.5</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </detailsRegression in
aaah shit, the commit only modified the backtrace :laughing: so "panicked at" no longer triggers before that..
`
maybe

Discussion:
} TraitItemKind::Const(ty, body_id) => body_id .and_then(|body_id| { <del> is_suggestable_infer_ty(ty) .then(|| infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident, "constant",)) </del> <ins> is_suggestable_infer_ty(ty).then(|| { infer_placeholder_type( tcx, def_id, body_id, ty.span, item.ident, "constant", ) }) </ins> }) .unwrap_or_else(|| icx.to_ty(ty)), TraitItemKind::Type(_, Some(ty)) => icx.to_ty(ty),

} } ItemKind::TyAlias(self_ty, _) => icx.to_ty(self_ty), <del> ItemKind::Impl(hir::Impl { self_ty, .. }) => { match self_ty.find_self_aliases() { spans if spans.len() > 0 => { let guar = tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: spans.into(), note: () }); tcx.ty_error(guar) }, _ => icx.to_ty(*self_ty), </del> <ins> ItemKind::Impl(hir::Impl { self_ty, .. }) => match self_ty.find_self_aliases() { spans if spans.len() > 0 => { let guar = tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: spans.into(), note: (), }); tcx.ty_error(guar) </ins> } <ins> _ => icx.to_ty(*self_ty), </ins> }, ItemKind::Fn(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id());

.. }) => { if in_trait && !tcx.impl_defaultness(owner).has_value() { <del> span_bug!(tcx.def_span(def_id), "tried to get type of this RPITIT with no definition"); </del> <ins> span_bug!( tcx.def_span(def_id), "tried to get type of this RPITIT with no definition" ); </ins> } find_opaque_ty_constraints_for_rpit(tcx, def_id, owner) }

tcx.adt_def(tcx.hir().get_parent_item(hir_id)).repr().discr_type().to_ty(tcx) } <del> Node::TypeBinding( TypeBinding { hir_id: binding_id, kind: TypeBindingKind::Equality { term: Term::Const(e) }, ident, .. }, ) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id) </del> <ins> Node::TypeBinding(TypeBinding { hir_id: binding_id, kind: TypeBindingKind::Equality { term: Term::Const(e) }, ident, .. }) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id) </ins> && e.hir_id == hir_id => { let Some(trait_def_id) = trait_ref.trait_def_id() else {

def_id.to_def_id(), ); if let Some(assoc_item) = assoc_item { <del> tcx.type_of(assoc_item.def_id).subst_identity() </del> <ins> tcx.type_of(assoc_item.def_id) .no_bound_vars() .expect("const parameter types cannot be generic") </ins> } else { // FIXME(associated_const_equality): add a useful error message here. tcx.ty_error_with_message(

} } <del> Node::TypeBinding( TypeBinding { hir_id: binding_id, gen_args, kind, ident, .. }, ) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id) </del> <ins> Node::TypeBinding(TypeBinding { hir_id: binding_id, gen_args, kind, ident, .. }) if let Node::TraitRef(trait_ref) = tcx.hir().get_parent(*binding_id) </ins> && let Some((idx, _)) = gen_args.args.iter().enumerate().find(|(_, arg)| { if let GenericArg::Const(ct) = arg {

}, def_id.to_def_id(), ); <del> if let Some(param) = assoc_item.map(|item| &tcx.generics_of(item.def_id).params[idx]).filter(|param| param.kind.is_ty_or_const()) </del> <ins> if let Some(assoc_item) = assoc_item && let param = &tcx.generics_of(assoc_item.def_id).params[idx] && matches!(param.kind, ty::GenericParamDefKind::Const { .. }) </ins> { <del> tcx.type_of(param.def_id).subst_identity() </del> <ins> tcx.type_of(param.def_id) .no_bound_vars() .expect("const parameter types cannot be generic") </ins> } else { // FIXME(associated_const_equality): add a useful error message here. tcx.ty_error_with_message( DUMMY_SP, <del> "Could not find associated const on trait", </del> <ins> "Could not find const param on associated item", </ins> ) } }

<ins> #![feature(generic_const_exprs)] //~^ WARN the feature `generic_const_exprs` is incomplete trait B { type U<T>; } fn f<T: B<U<1i32> = ()>>() {} //~^ ERROR constant provided when a type was expected fn main() {} </ins>

<ins> warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/mismatched-gat-subst-kind.rs:1:12 | LL | #![feature(generic_const_exprs)] |            ^^^^^^^^^^^^^^^^^^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information = note: `#[warn(incomplete_features)]` on by default error[E0747]: constant provided when a type was expected --> $DIR/mismatched-gat-subst-kind.rs:8:13 | LL | fn f<T: B<U<1i32> = ()>>() {} |             ^^^^ error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0747`. </ins>