]> git.proxmox.com Git - rustc.git/blob - src/test/ui/invalid/invalid-rustc_legacy_const_generics-arguments.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / invalid / invalid-rustc_legacy_const_generics-arguments.rs
1 #![feature(rustc_attrs)]
2
3 #[rustc_legacy_const_generics(0)] //~ ERROR #[rustc_legacy_const_generics] must have one index for
4 fn foo1() {}
5
6 #[rustc_legacy_const_generics(1)] //~ ERROR index exceeds number of arguments
7 fn foo2<const X: usize>() {}
8
9 #[rustc_legacy_const_generics(2)] //~ ERROR index exceeds number of arguments
10 fn foo3<const X: usize>(_: u8) {}
11
12 #[rustc_legacy_const_generics(a)] //~ ERROR arguments should be non-negative integers
13 fn foo4<const X: usize>() {}
14
15 #[rustc_legacy_const_generics(1, a, 2, b)] //~ ERROR arguments should be non-negative integers
16 fn foo5<const X: usize, const Y: usize, const Z: usize, const W: usize>() {}
17
18 #[rustc_legacy_const_generics(0)] //~ ERROR attribute should be applied to a function
19 struct S;
20
21 #[rustc_legacy_const_generics(0usize)] //~ ERROR suffixed literals are not allowed in attributes
22 fn foo6<const X: usize>() {}
23
24 extern {
25 #[rustc_legacy_const_generics(1)] //~ ERROR attribute should be applied to a function
26 fn foo7<const X: usize>(); //~ ERROR foreign items may not have const parameters
27 }
28
29 #[rustc_legacy_const_generics(0)] //~ ERROR #[rustc_legacy_const_generics] functions must only have
30 fn foo8<X>() {}
31
32 #[rustc_legacy_const_generics] //~ ERROR malformed `rustc_legacy_const_generics` attribute
33 fn bar1() {}
34
35 #[rustc_legacy_const_generics = 1] //~ ERROR malformed `rustc_legacy_const_generics` attribute
36 fn bar2() {}
37
38 fn main() {}