]> git.lizzy.rs Git - rust.git/blob - src/test/ui/test-attrs/test-on-not-fn.stderr
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / test-attrs / test-on-not-fn.stderr
1 error: the `#[test]` attribute may only be used on a non-associated function
2   --> $DIR/test-on-not-fn.rs:3:1
3    |
4 LL | #[test]
5    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
6 LL | mod test {}
7    | ----------- expected a non-associated function, found a module
8    |
9 help: replace with conditional compilation to make the item only exist when tests are being run
10    |
11 LL | #[cfg(test)]
12    | ~~~~~~~~~~~~
13
14 error: the `#[test]` attribute may only be used on a non-associated function
15   --> $DIR/test-on-not-fn.rs:6:1
16    |
17 LL |   #[test]
18    |   ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
19 LL | / mod loooooooooooooong_teeeeeeeeeest {
20 LL | |     /*
21 LL | |     this is a comment
22 LL | |     this comment goes on for a very long time
23 ...  |
24 LL | |     */
25 LL | | }
26    | |_- expected a non-associated function, found a module
27    |
28 help: replace with conditional compilation to make the item only exist when tests are being run
29    |
30 LL | #[cfg(test)]
31    | ~~~~~~~~~~~~
32
33 error: the `#[test]` attribute may only be used on a non-associated function
34   --> $DIR/test-on-not-fn.rs:20:1
35    |
36 LL | #[test]
37    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
38 LL | extern "C" {}
39    | ------------- expected a non-associated function, found an extern block
40    |
41 help: replace with conditional compilation to make the item only exist when tests are being run
42    |
43 LL | #[cfg(test)]
44    | ~~~~~~~~~~~~
45
46 error: the `#[test]` attribute may only be used on a non-associated function
47   --> $DIR/test-on-not-fn.rs:23:1
48    |
49 LL | #[test]
50    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
51 LL | trait Foo {}
52    | ------------ expected a non-associated function, found a trait
53    |
54 help: replace with conditional compilation to make the item only exist when tests are being run
55    |
56 LL | #[cfg(test)]
57    | ~~~~~~~~~~~~
58
59 error: the `#[test]` attribute may only be used on a non-associated function
60   --> $DIR/test-on-not-fn.rs:26:1
61    |
62 LL | #[test]
63    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
64 LL | impl Foo for i32 {}
65    | ------------------- expected a non-associated function, found an implementation
66    |
67 help: replace with conditional compilation to make the item only exist when tests are being run
68    |
69 LL | #[cfg(test)]
70    | ~~~~~~~~~~~~
71
72 error: the `#[test]` attribute may only be used on a non-associated function
73   --> $DIR/test-on-not-fn.rs:29:1
74    |
75 LL | #[test]
76    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
77 LL | const FOO: i32 = -1_i32;
78    | ------------------------ expected a non-associated function, found a constant item
79    |
80 help: replace with conditional compilation to make the item only exist when tests are being run
81    |
82 LL | #[cfg(test)]
83    | ~~~~~~~~~~~~
84
85 error: the `#[test]` attribute may only be used on a non-associated function
86   --> $DIR/test-on-not-fn.rs:32:1
87    |
88 LL | #[test]
89    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
90 LL | static BAR: u64 = 10_000_u64;
91    | ----------------------------- expected a non-associated function, found a static item
92    |
93 help: replace with conditional compilation to make the item only exist when tests are being run
94    |
95 LL | #[cfg(test)]
96    | ~~~~~~~~~~~~
97
98 error: the `#[test]` attribute may only be used on a non-associated function
99   --> $DIR/test-on-not-fn.rs:35:1
100    |
101 LL |   #[test]
102    |   ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
103 LL | / enum MyUnit {
104 LL | |     Unit,
105 LL | | }
106    | |_- expected a non-associated function, found an enum
107    |
108 help: replace with conditional compilation to make the item only exist when tests are being run
109    |
110 LL | #[cfg(test)]
111    | ~~~~~~~~~~~~
112
113 error: the `#[test]` attribute may only be used on a non-associated function
114   --> $DIR/test-on-not-fn.rs:40:1
115    |
116 LL | #[test]
117    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
118 LL | struct NewI32(i32);
119    | ------------------- expected a non-associated function, found a struct
120    |
121 help: replace with conditional compilation to make the item only exist when tests are being run
122    |
123 LL | #[cfg(test)]
124    | ~~~~~~~~~~~~
125
126 error: the `#[test]` attribute may only be used on a non-associated function
127   --> $DIR/test-on-not-fn.rs:43:1
128    |
129 LL |   #[test]
130    |   ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
131 LL | / union Spooky {
132 LL | |     x: i32,
133 LL | |     y: u32,
134 LL | | }
135    | |_- expected a non-associated function, found a union
136    |
137 help: replace with conditional compilation to make the item only exist when tests are being run
138    |
139 LL | #[cfg(test)]
140    | ~~~~~~~~~~~~
141
142 error: the `#[test]` attribute may only be used on a non-associated function
143   --> $DIR/test-on-not-fn.rs:50:1
144    |
145 LL |   #[test]
146    |   ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
147 LL |   #[derive(Copy, Clone, Debug)]
148 LL | / struct MoreAttrs {
149 LL | |     a: i32,
150 LL | |     b: u64,
151 LL | | }
152    | |_- expected a non-associated function, found a struct
153    |
154 help: replace with conditional compilation to make the item only exist when tests are being run
155    |
156 LL | #[cfg(test)]
157    | ~~~~~~~~~~~~
158
159 warning: the `#[test]` attribute may only be used on a non-associated function
160   --> $DIR/test-on-not-fn.rs:61:1
161    |
162 LL | #[test]
163    | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions
164 LL | foo!();
165    | ------- expected a non-associated function, found an item macro invocation
166    |
167 help: replace with conditional compilation to make the item only exist when tests are being run
168    |
169 LL | #[cfg(test)]
170    | ~~~~~~~~~~~~
171
172 error: aborting due to 11 previous errors; 1 warning emitted
173