summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/legacy-const-generics-bad.rs
blob: 538eee337cc6db3f2b0230f2ca19d126e711974b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// aux-build:legacy-const-generics.rs

extern crate legacy_const_generics;

fn foo<const N: usize>() {
    let a = 1;
    legacy_const_generics::foo(0, a, 2);
    //~^ ERROR attempt to use a non-constant value in a constant

    legacy_const_generics::foo(0, N, 2);

    legacy_const_generics::foo(0, N + 1, 2);
    //~^ ERROR generic parameters may not be used in const operations
}

fn main() {}