2021-08-18 15:15:33 -05:00
|
|
|
//@ revisions: cfail
|
2021-10-23 10:57:49 -05:00
|
|
|
#![feature(generic_const_exprs, adt_const_params)]
|
2021-08-18 15:15:33 -05:00
|
|
|
#![allow(incomplete_features)]
|
2023-05-16 23:05:46 -05:00
|
|
|
|
|
|
|
use std::marker::ConstParamTy;
|
|
|
|
|
|
|
|
#[derive(PartialEq, Eq, ConstParamTy)]
|
|
|
|
struct NonZeroUsize(usize);
|
|
|
|
|
|
|
|
impl NonZeroUsize {
|
|
|
|
const fn get(self) -> usize {
|
|
|
|
self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-18 15:15:33 -05:00
|
|
|
// regression test for #77650
|
2023-05-16 23:05:46 -05:00
|
|
|
struct C<T, const N: NonZeroUsize>([T; N.get()])
|
2021-08-18 15:15:33 -05:00
|
|
|
where
|
|
|
|
[T; N.get()]: Sized;
|
2023-05-16 23:05:46 -05:00
|
|
|
impl<'a, const N: NonZeroUsize, A, B: PartialEq<A>> PartialEq<&'a [A]> for C<B, N>
|
2021-08-18 15:15:33 -05:00
|
|
|
where
|
|
|
|
[B; N.get()]: Sized,
|
|
|
|
{
|
|
|
|
fn eq(&self, other: &&'a [A]) -> bool {
|
|
|
|
self.0 == other
|
|
|
|
//~^ error: can't compare
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|