fn compare_generic_param_kinds<'tcx>(
tcx: TyCtxt<'tcx>,
impl_item: &AssocItem,
trait_item: &AssocItem,
delay: bool
) -> Result<(), ErrorGuaranteed>
Expand description
Checks that all parameters in the generics of a given assoc item in a trait impl have the same kind as the respective generic parameter in the trait def.
For example all 4 errors in the following code are emitted here:
trait Foo {
fn foo<const N: u8>();
type bar<const N: u8>;
fn baz<const N: u32>();
type blah<T>;
}
impl Foo for () {
fn foo<const N: u64>() {}
//~^ error
type bar<const N: u64> {}
//~^ error
fn baz<T>() {}
//~^ error
type blah<const N: i64> = u32;
//~^ error
}
This function does not handle lifetime parameters