summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/issues/issue-105037.rs
blob: f7d239499439688047b95f81ad9543c989e25525 (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
31
32
33
34
35
// run-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
#![allow(dead_code)]

trait Table<const D: usize>: Sync {
    const COLUMNS: usize;
}

struct Table1<const D: usize>;
impl<const D: usize> Table<D> for Table1<D> {
    const COLUMNS: usize = 123;
}

struct Table2<const D: usize>;
impl<const D: usize> Table<D> for Table2<D> {
    const COLUMNS: usize = 456;
}

fn process_table<T: Table<D>, const D: usize>(_table: T)
where
    [(); T::COLUMNS]:,
{
}

fn process_all_tables<const D: usize>()
where
    [(); Table2::<D>::COLUMNS]:,
    [(); Table1::<D>::COLUMNS]:,
{
    process_table(Table1::<D>);
    process_table(Table2::<D>);
}

fn main() {}