]> git.proxmox.com Git - rustc.git/blame - tests/ui/parser/assoc-static-syntactic-fail.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / tests / ui / parser / assoc-static-syntactic-fail.rs
CommitLineData
74b04a01
XL
1// Syntactically, we do allow e.g., `static X: u8 = 0;` as an associated item.
2
3fn main() {}
4
5#[cfg(FALSE)]
6impl S {
7 static IA: u8 = 0; //~ ERROR associated `static` items are not allowed
8 static IB: u8; //~ ERROR associated `static` items are not allowed
9 default static IC: u8 = 0; //~ ERROR associated `static` items are not allowed
10 //~^ ERROR a static item cannot be `default`
11 pub(crate) default static ID: u8; //~ ERROR associated `static` items are not allowed
12 //~^ ERROR a static item cannot be `default`
13}
14
15#[cfg(FALSE)]
16trait T {
17 static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
18 static TB: u8; //~ ERROR associated `static` items are not allowed
19 default static TC: u8 = 0; //~ ERROR associated `static` items are not allowed
20 //~^ ERROR a static item cannot be `default`
21 pub(crate) default static TD: u8; //~ ERROR associated `static` items are not allowed
22 //~^ ERROR a static item cannot be `default`
23}
24
25#[cfg(FALSE)]
26impl T for S {
27 static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
28 static TB: u8; //~ ERROR associated `static` items are not allowed
29 default static TC: u8 = 0; //~ ERROR associated `static` items are not allowed
30 //~^ ERROR a static item cannot be `default`
31 pub default static TD: u8; //~ ERROR associated `static` items are not allowed
32 //~^ ERROR a static item cannot be `default`
33}