]> git.proxmox.com Git - rustc.git/blob - src/test/ui/parser/default-on-wrong-item-kind.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / parser / default-on-wrong-item-kind.rs
1 // Test parsing for `default` where it doesn't belong.
2 // Specifically, we are interested in kinds of items or items in certain contexts.
3 // Also test item kinds in `extern` blocks and associated contexts which are not allowed there.
4
5 fn main() {}
6
7 #[cfg(FALSE)]
8 mod free_items {
9 default extern crate foo; //~ ERROR an extern crate cannot be `default`
10 default use foo; //~ ERROR a `use` import cannot be `default`
11 default static foo: u8; //~ ERROR a static item cannot be `default`
12 default const foo: u8;
13 default fn foo();
14 default mod foo {} //~ ERROR a module cannot be `default`
15 default extern "C" {} //~ ERROR an extern block cannot be `default`
16 default type foo = u8;
17 default enum foo {} //~ ERROR an enum cannot be `default`
18 default struct foo {} //~ ERROR a struct cannot be `default`
19 default union foo {} //~ ERROR a union cannot be `default`
20 default trait foo {} //~ ERROR a trait cannot be `default`
21 default trait foo = Ord; //~ ERROR a trait alias cannot be `default`
22 default impl foo {}
23 default!();
24 default::foo::bar!();
25 default default!(); //~ ERROR an item macro invocation cannot be `default`
26 default default::foo::bar!(); //~ ERROR an item macro invocation cannot be `default`
27 default macro foo {} //~ ERROR a macro definition cannot be `default`
28 default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
29 }
30
31 #[cfg(FALSE)]
32 extern "C" {
33 default extern crate foo; //~ ERROR an extern crate cannot be `default`
34 //~^ ERROR extern crate is not supported in `extern` blocks
35 default use foo; //~ ERROR a `use` import cannot be `default`
36 //~^ ERROR `use` import is not supported in `extern` blocks
37 default static foo: u8; //~ ERROR a static item cannot be `default`
38 default const foo: u8;
39 //~^ ERROR extern items cannot be `const`
40 default fn foo();
41 default mod foo {} //~ ERROR a module cannot be `default`
42 //~^ ERROR module is not supported in `extern` blocks
43 default extern "C" {} //~ ERROR an extern block cannot be `default`
44 //~^ ERROR extern block is not supported in `extern` blocks
45 default type foo = u8;
46 default enum foo {} //~ ERROR an enum cannot be `default`
47 //~^ ERROR enum is not supported in `extern` blocks
48 default struct foo {} //~ ERROR a struct cannot be `default`
49 //~^ ERROR struct is not supported in `extern` blocks
50 default union foo {} //~ ERROR a union cannot be `default`
51 //~^ ERROR union is not supported in `extern` blocks
52 default trait foo {} //~ ERROR a trait cannot be `default`
53 //~^ ERROR trait is not supported in `extern` blocks
54 default trait foo = Ord; //~ ERROR a trait alias cannot be `default`
55 //~^ ERROR trait alias is not supported in `extern` blocks
56 default impl foo {}
57 //~^ ERROR implementation is not supported in `extern` blocks
58 default!();
59 default::foo::bar!();
60 default default!(); //~ ERROR an item macro invocation cannot be `default`
61 default default::foo::bar!(); //~ ERROR an item macro invocation cannot be `default`
62 default macro foo {} //~ ERROR a macro definition cannot be `default`
63 //~^ ERROR macro definition is not supported in `extern` blocks
64 default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
65 //~^ ERROR macro definition is not supported in `extern` blocks
66 }
67
68 #[cfg(FALSE)]
69 impl S {
70 default extern crate foo; //~ ERROR an extern crate cannot be `default`
71 //~^ ERROR extern crate is not supported in `trait`s or `impl`s
72 default use foo; //~ ERROR a `use` import cannot be `default`
73 //~^ ERROR `use` import is not supported in `trait`s or `impl`s
74 default static foo: u8; //~ ERROR a static item cannot be `default`
75 //~^ ERROR associated `static` items are not allowed
76 default const foo: u8;
77 default fn foo();
78 default mod foo {}//~ ERROR a module cannot be `default`
79 //~^ ERROR module is not supported in `trait`s or `impl`s
80 default extern "C" {} //~ ERROR an extern block cannot be `default`
81 //~^ ERROR extern block is not supported in `trait`s or `impl`s
82 default type foo = u8;
83 default enum foo {} //~ ERROR an enum cannot be `default`
84 //~^ ERROR enum is not supported in `trait`s or `impl`s
85 default struct foo {} //~ ERROR a struct cannot be `default`
86 //~^ ERROR struct is not supported in `trait`s or `impl`s
87 default union foo {} //~ ERROR a union cannot be `default`
88 //~^ ERROR union is not supported in `trait`s or `impl`s
89 default trait foo {} //~ ERROR a trait cannot be `default`
90 //~^ ERROR trait is not supported in `trait`s or `impl`s
91 default trait foo = Ord; //~ ERROR a trait alias cannot be `default`
92 //~^ ERROR trait alias is not supported in `trait`s or `impl`s
93 default impl foo {}
94 //~^ ERROR implementation is not supported in `trait`s or `impl`s
95 default!();
96 default::foo::bar!();
97 default default!(); //~ ERROR an item macro invocation cannot be `default`
98 default default::foo::bar!(); //~ ERROR an item macro invocation cannot be `default`
99 default macro foo {} //~ ERROR a macro definition cannot be `default`
100 //~^ ERROR macro definition is not supported in `trait`s or `impl`s
101 default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
102 //~^ ERROR macro definition is not supported in `trait`s or `impl`s
103 }
104
105 #[cfg(FALSE)]
106 trait T {
107 default extern crate foo; //~ ERROR an extern crate cannot be `default`
108 //~^ ERROR extern crate is not supported in `trait`s or `impl`s
109 default use foo; //~ ERROR a `use` import cannot be `default`
110 //~^ ERROR `use` import is not supported in `trait`s or `impl`s
111 default static foo: u8; //~ ERROR a static item cannot be `default`
112 //~^ ERROR associated `static` items are not allowed
113 default const foo: u8;
114 default fn foo();
115 default mod foo {}//~ ERROR a module cannot be `default`
116 //~^ ERROR module is not supported in `trait`s or `impl`s
117 default extern "C" {} //~ ERROR an extern block cannot be `default`
118 //~^ ERROR extern block is not supported in `trait`s or `impl`s
119 default type foo = u8;
120 default enum foo {} //~ ERROR an enum cannot be `default`
121 //~^ ERROR enum is not supported in `trait`s or `impl`s
122 default struct foo {} //~ ERROR a struct cannot be `default`
123 //~^ ERROR struct is not supported in `trait`s or `impl`s
124 default union foo {} //~ ERROR a union cannot be `default`
125 //~^ ERROR union is not supported in `trait`s or `impl`s
126 default trait foo {} //~ ERROR a trait cannot be `default`
127 //~^ ERROR trait is not supported in `trait`s or `impl`s
128 default trait foo = Ord; //~ ERROR a trait alias cannot be `default`
129 //~^ ERROR trait alias is not supported in `trait`s or `impl`s
130 default impl foo {}
131 //~^ ERROR implementation is not supported in `trait`s or `impl`s
132 default!();
133 default::foo::bar!();
134 default default!(); //~ ERROR an item macro invocation cannot be `default`
135 default default::foo::bar!(); //~ ERROR an item macro invocation cannot be `default`
136 default macro foo {} //~ ERROR a macro definition cannot be `default`
137 //~^ ERROR macro definition is not supported in `trait`s or `impl`s
138 default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
139 //~^ ERROR macro definition is not supported in `trait`s or `impl`s
140 }