summaryrefslogtreecommitdiffstats
path: root/tests/incremental/const-generics/hash-tyvid-regression-2.rs
blob: 33f226ff611e81e99f06c0066bbf98a740deb6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// revisions: cfail
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]

use std::marker::ConstParamTy;

#[derive(PartialEq, Eq, ConstParamTy)]
struct NonZeroUsize(usize);

impl NonZeroUsize {
    const fn get(self) -> usize {
        self.0
    }
}

// regression test for #77650
struct C<T, const N: NonZeroUsize>([T; N.get()])
where
    [T; N.get()]: Sized;
impl<'a, const N: NonZeroUsize, A, B: PartialEq<A>> PartialEq<&'a [A]> for C<B, N>
where
    [B; N.get()]: Sized,
{
    fn eq(&self, other: &&'a [A]) -> bool {
        self.0 == other
        //~^ error: can't compare
    }
}

fn main() {}