Debian Codegraph @

gcc/testsuite/rust/compile/const_generics_1.rs

raw
1 // { dg-additional-options "-w" }
2
3 // There are errors about unused generic parameters, but we can't handle that yet.
4 // Still, this code is invalid Rust.
5
6 #[lang = "sized"]
7 pub trait Sized {}
8
9 mod sain {
10 struct Foo<const N: usize>;
11 struct Bar<T, const N: usize>;
12 struct Baz<'l, T, const N: usize>;
13 }
14
15 mod doux {
16 struct Foo<const N: usize = 15>;
17 struct Bar<T, const N: usize = { 14 * 2 }>;
18
19 const N_DEFAULT: usize = 3;
20
21 struct Baz<'l, T, const N: usize = N_DEFAULT>;
22 }