aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/const_generics_1.rs
blob: 5d4ca64c81d849bcc41f715f4f699792659b4da3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// { dg-additional-options "-w" }

// There are errors about unused generic parameters, but we can't handle that yet.
// Still, this code is invalid Rust.

#[lang = "sized"]
pub trait Sized {}

mod sain {
    struct Foo<const N: usize>;
    struct Bar<T, const N: usize>;
    struct Baz<'l, T, const N: usize>;
}

mod doux {
    struct Foo<const N: usize = 15>;
    struct Bar<T, const N: usize = { 14 * 2 }>;

    const N_DEFAULT: usize = 3;

    struct Baz<'l, T, const N: usize = N_DEFAULT>;
}