1- // Tests that `#[rust_gpu:: spirv(...)]` attributes cannot be applied to the wrong "targets"
1+ // Tests that `#[spirv(...)]` attributes cannot be applied to the wrong "targets"
22// (i.e. various kinds of definitions and other syntactic categories).
33
44// build-fail
1010 trait_alias
1111) ]
1212
13+ use spirv_std:: spirv;
14+
1315// NOTE(eddyb) in the interest of keeping this test manageable, only one of
14- // each of the following categories of `#[rust_gpu:: spirv(...)]` attributes is used:
16+ // each of the following categories of `#[spirv(...)]` attributes is used:
1517// * entry: `vertex`
1618// * storage class: `uniform`
1719// * builtin: `position`
1820
1921// NOTE(eddyb) accounting for the number of errors this test actually produces:
2022// * 437 errors, all "attribute is only valid on" (see `invalid-target.stderr`)
21- // * 41 uses of `#[rust_gpu:: spirv(...)]` in this test
22- // * at most 11 attributes per `#[rust_gpu:: spirv(...)]`, so an upper bound of `41*11 = 451`
23+ // * 41 uses of `#[spirv(...)]` in this test
24+ // * at most 11 attributes per `#[spirv(...)]`, so an upper bound of `41*11 = 451`
2325// * the difference between 451 and 437 is 14, i.e. valid attributes, made up of:
2426// * 4 on `_Struct`
2527// * 4 on functions, i.e. 1 on each of:
2931// * `_fn`
3032// * 6 on `_entry_param`
3133
32- // NOTE(shesp) Directly using `#[rust_gpu:: spirv(...)]` because macro attributes are invalid in most contexts
34+ // NOTE(shesp) Directly using `#[spirv(...)]` because macro attributes are invalid in most contexts
3335
34- #[ rust_gpu :: spirv(
36+ #[ spirv(
3537 sampler, block, sampled_image, generic_image_type, // struct-only
3638 vertex, // fn-only
3739 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -40,77 +42,77 @@ macro_rules! _macro {
4042 ( ) => { } ;
4143}
4244
43- #[ rust_gpu :: spirv(
45+ #[ spirv(
4446 sampler, block, sampled_image, generic_image_type, // struct-only
4547 vertex, // fn-only
4648 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
4749) ]
4850extern crate spirv_std as _;
4951
50- #[ rust_gpu :: spirv(
52+ #[ spirv(
5153 sampler, block, sampled_image, generic_image_type, // struct-only
5254 vertex, // fn-only
5355 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
5456) ]
5557use spirv_std as _;
5658
57- #[ rust_gpu :: spirv(
59+ #[ spirv(
5860 sampler, block, sampled_image, generic_image_type, // struct-only
5961 vertex, // fn-only
6062 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
6163) ]
6264mod _mod { }
6365
64- #[ rust_gpu :: spirv(
66+ #[ spirv(
6567 sampler, block, sampled_image, generic_image_type, // struct-only
6668 vertex, // fn-only
6769 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
6870) ]
6971extern "C" {
70- #[ rust_gpu :: spirv(
72+ #[ spirv(
7173 sampler, block, sampled_image, generic_image_type, // struct-only
7274 vertex, // fn-only
7375 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
7476 ) ]
7577 type _ForeignTy ;
7678
77- #[ rust_gpu :: spirv(
79+ #[ spirv(
7880 sampler, block, sampled_image, generic_image_type, // struct-only
7981 vertex, // fn-only
8082 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
8183 ) ]
8284 static _FOREIGN_STATIC: ( ) ;
8385
84- #[ rust_gpu :: spirv(
86+ #[ spirv(
8587 sampler, block, sampled_image, generic_image_type, // struct-only
8688 vertex, // fn-only
8789 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
8890 ) ]
8991 fn _foreign_fn ( ) ;
9092}
9193
92- #[ rust_gpu :: spirv(
94+ #[ spirv(
9395 sampler, block, sampled_image, generic_image_type, // struct-only
9496 vertex, // fn-only
9597 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
9698) ]
9799static _STATIC: ( ) = ( ) ;
98100
99- #[ rust_gpu :: spirv(
101+ #[ spirv(
100102 sampler, block, sampled_image, generic_image_type, // struct-only
101103 vertex, // fn-only
102104 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
103105) ]
104106const _CONST: ( ) = ( ) ;
105107
106- #[ rust_gpu :: spirv(
108+ #[ spirv(
107109 sampler, block, sampled_image, generic_image_type, // struct-only
108110 vertex, // fn-only
109111 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
110112) ]
111113type _TyAlias = ( ) ;
112114
113- #[ rust_gpu :: spirv(
115+ #[ spirv(
114116 sampler, block, sampled_image, generic_image_type, // struct-only
115117 vertex, // fn-only
116118 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -121,19 +123,19 @@ fn _opaque_ty_definer() -> _OpaqueTy {
121123 ( )
122124}
123125
124- #[ rust_gpu :: spirv(
126+ #[ spirv(
125127 sampler, block, sampled_image, generic_image_type, // struct-only
126128 vertex, // fn-only
127129 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
128130) ]
129131enum _Enum {
130- #[ rust_gpu :: spirv(
132+ #[ spirv(
131133 sampler, block, sampled_image, generic_image_type, // struct-only
132134 vertex, // fn-only
133135 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
134136 ) ]
135137 _Variant {
136- #[ rust_gpu :: spirv(
138+ #[ spirv(
137139 sampler, block, sampled_image, generic_image_type, // struct-only
138140 vertex, // fn-only
139141 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -142,148 +144,148 @@ enum _Enum {
142144 } ,
143145}
144146
145- #[ rust_gpu :: spirv(
147+ #[ spirv(
146148 sampler, block, sampled_image, generic_image_type, // struct-only
147149 vertex, // fn-only
148150 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
149151) ]
150152union _Union {
151- #[ rust_gpu :: spirv(
153+ #[ spirv(
152154 sampler, block, sampled_image, generic_image_type, // struct-only
153155 vertex, // fn-only
154156 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
155157 ) ]
156158 _field : ( ) ,
157159}
158160
159- #[ rust_gpu :: spirv(
161+ #[ spirv(
160162 vertex, // fn-only
161163 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
162164) ]
163165struct _Struct {
164- #[ rust_gpu :: spirv(
166+ #[ spirv(
165167 sampler, block, sampled_image, generic_image_type, // struct-only
166168 vertex, // fn-only
167169 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
168170 ) ]
169171 _field : ( ) ,
170172}
171173
172- #[ rust_gpu :: spirv(
174+ #[ spirv(
173175 sampler, block, sampled_image, generic_image_type, // struct-only
174176 vertex, // fn-only
175177 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
176178) ]
177179impl _Struct {
178- #[ rust_gpu :: spirv(
180+ #[ spirv(
179181 sampler, block, sampled_image, generic_image_type, // struct-only
180182 vertex, // fn-only
181183 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
182184 ) ]
183185 const _INHERENT_ASSOC_CONST: ( ) = ( ) ;
184186
185- #[ rust_gpu :: spirv(
187+ #[ spirv(
186188 sampler, block, sampled_image, generic_image_type, // struct-only
187189 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
188190 ) ]
189191 fn _inherent_method ( ) { }
190192}
191193
192- #[ rust_gpu :: spirv(
194+ #[ spirv(
193195 sampler, block, sampled_image, generic_image_type, // struct-only
194196 vertex, // fn-only
195197 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
196198) ]
197199trait _TraitAlias = Copy ;
198200
199- #[ rust_gpu :: spirv(
201+ #[ spirv(
200202 sampler, block, sampled_image, generic_image_type, // struct-only
201203 vertex, // fn-only
202204 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
203205) ]
204206trait _Trait {
205- #[ rust_gpu :: spirv(
207+ #[ spirv(
206208 sampler, block, sampled_image, generic_image_type, // struct-only
207209 vertex, // fn-only
208210 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
209211 ) ]
210212 type _AssocTy ;
211213
212- #[ rust_gpu :: spirv(
214+ #[ spirv(
213215 sampler, block, sampled_image, generic_image_type, // struct-only
214216 vertex, // fn-only
215217 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
216218 ) ]
217219 const _TRAIT_ASSOC_CONST: ( ) ;
218220
219- #[ rust_gpu :: spirv(
221+ #[ spirv(
220222 sampler, block, sampled_image, generic_image_type, // struct-only
221223 vertex, // fn-only
222224 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
223225 ) ]
224226 fn _trait_method ( ) ;
225227
226- #[ rust_gpu :: spirv(
228+ #[ spirv(
227229 sampler, block, sampled_image, generic_image_type, // struct-only
228230 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
229231 ) ]
230232 fn _trait_method_with_default ( ) { }
231233}
232234
233- #[ rust_gpu :: spirv(
235+ #[ spirv(
234236 sampler, block, sampled_image, generic_image_type, // struct-only
235237 vertex, // fn-only
236238 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
237239) ]
238240impl _Trait for ( ) {
239- #[ rust_gpu :: spirv(
241+ #[ spirv(
240242 sampler, block, sampled_image, generic_image_type, // struct-only
241243 vertex, // fn-only
242244 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
243245 ) ]
244246 type _AssocTy = ( ) ;
245247
246- #[ rust_gpu :: spirv(
248+ #[ spirv(
247249 sampler, block, sampled_image, generic_image_type, // struct-only
248250 vertex, // fn-only
249251 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
250252 ) ]
251253 const _TRAIT_ASSOC_CONST: ( ) = ( ) ;
252254
253- #[ rust_gpu :: spirv(
255+ #[ spirv(
254256 sampler, block, sampled_image, generic_image_type, // struct-only
255257 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
256258 ) ]
257259 fn _trait_method ( ) { }
258260}
259261
260- #[ rust_gpu :: spirv(
262+ #[ spirv(
261263 sampler, block, sampled_image, generic_image_type, // struct-only
262264 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
263265) ]
264266fn _fn(
265- #[ rust_gpu :: spirv(
267+ #[ spirv(
266268 sampler, block, sampled_image, generic_image_type, // struct-only
267269 vertex, // fn-only
268270 ) ]
269271 _entry_param : ( ) ,
270272) {
271- #[ rust_gpu :: spirv(
273+ #[ spirv(
272274 sampler, block, sampled_image, generic_image_type, // struct-only
273275 vertex, // fn-only
274276 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
275277 ) ]
276278 let _statement = ( ) ;
277279
278- let _closure = #[ rust_gpu :: spirv (
280+ let _closure = #[ spirv (
279281 sampler, block, sampled_image, generic_image_type, // struct-only
280282 vertex, // fn-only
281283 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
282284 ) ]
283285 || { } ;
284286
285287 (
286- #[ rust_gpu :: spirv(
288+ #[ spirv(
287289 sampler, block, sampled_image, generic_image_type, // struct-only
288290 vertex, // fn-only
289291 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -293,7 +295,7 @@ fn _fn(
293295 ) ;
294296
295297 match ( ) {
296- #[ rust_gpu :: spirv(
298+ #[ spirv(
297299 sampler, block, sampled_image, generic_image_type, // struct-only
298300 vertex, // fn-only
299301 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -303,17 +305,17 @@ fn _fn(
303305}
304306
305307fn _fn_with_generics<
306- #[ rust_gpu :: spirv(
308+ #[ spirv(
307309 sampler, block, sampled_image, generic_image_type, // struct-only
308310 vertex, // fn-only
309311 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
310312 ) ] ' _lifetime_param,
311- #[ rust_gpu :: spirv(
313+ #[ spirv(
312314 sampler, block, sampled_image, generic_image_type, // struct-only
313315 vertex, // fn-only
314316 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
315317 ) ] _TyParam,
316- #[ rust_gpu :: spirv (
318+ #[ spirv (
317319 sampler, block, sampled_image, generic_image_type, // struct-only
318320 vertex, // fn-only
319321 uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
0 commit comments