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"
2
2
// (i.e. various kinds of definitions and other syntactic categories).
3
3
4
4
// build-fail
10
10
trait_alias
11
11
) ]
12
12
13
+ use spirv_std:: spirv;
14
+
13
15
// 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:
15
17
// * entry: `vertex`
16
18
// * storage class: `uniform`
17
19
// * builtin: `position`
18
20
19
21
// NOTE(eddyb) accounting for the number of errors this test actually produces:
20
22
// * 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`
23
25
// * the difference between 451 and 437 is 14, i.e. valid attributes, made up of:
24
26
// * 4 on `_Struct`
25
27
// * 4 on functions, i.e. 1 on each of:
29
31
// * `_fn`
30
32
// * 6 on `_entry_param`
31
33
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
33
35
34
- #[ rust_gpu :: spirv(
36
+ #[ spirv(
35
37
sampler, block, sampled_image, generic_image_type, // struct-only
36
38
vertex, // fn-only
37
39
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -40,77 +42,77 @@ macro_rules! _macro {
40
42
( ) => { } ;
41
43
}
42
44
43
- #[ rust_gpu :: spirv(
45
+ #[ spirv(
44
46
sampler, block, sampled_image, generic_image_type, // struct-only
45
47
vertex, // fn-only
46
48
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
47
49
) ]
48
50
extern crate spirv_std as _;
49
51
50
- #[ rust_gpu :: spirv(
52
+ #[ spirv(
51
53
sampler, block, sampled_image, generic_image_type, // struct-only
52
54
vertex, // fn-only
53
55
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
54
56
) ]
55
57
use spirv_std as _;
56
58
57
- #[ rust_gpu :: spirv(
59
+ #[ spirv(
58
60
sampler, block, sampled_image, generic_image_type, // struct-only
59
61
vertex, // fn-only
60
62
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
61
63
) ]
62
64
mod _mod { }
63
65
64
- #[ rust_gpu :: spirv(
66
+ #[ spirv(
65
67
sampler, block, sampled_image, generic_image_type, // struct-only
66
68
vertex, // fn-only
67
69
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
68
70
) ]
69
71
extern "C" {
70
- #[ rust_gpu :: spirv(
72
+ #[ spirv(
71
73
sampler, block, sampled_image, generic_image_type, // struct-only
72
74
vertex, // fn-only
73
75
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
74
76
) ]
75
77
type _ForeignTy ;
76
78
77
- #[ rust_gpu :: spirv(
79
+ #[ spirv(
78
80
sampler, block, sampled_image, generic_image_type, // struct-only
79
81
vertex, // fn-only
80
82
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
81
83
) ]
82
84
static _FOREIGN_STATIC: ( ) ;
83
85
84
- #[ rust_gpu :: spirv(
86
+ #[ spirv(
85
87
sampler, block, sampled_image, generic_image_type, // struct-only
86
88
vertex, // fn-only
87
89
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
88
90
) ]
89
91
fn _foreign_fn ( ) ;
90
92
}
91
93
92
- #[ rust_gpu :: spirv(
94
+ #[ spirv(
93
95
sampler, block, sampled_image, generic_image_type, // struct-only
94
96
vertex, // fn-only
95
97
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
96
98
) ]
97
99
static _STATIC: ( ) = ( ) ;
98
100
99
- #[ rust_gpu :: spirv(
101
+ #[ spirv(
100
102
sampler, block, sampled_image, generic_image_type, // struct-only
101
103
vertex, // fn-only
102
104
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
103
105
) ]
104
106
const _CONST: ( ) = ( ) ;
105
107
106
- #[ rust_gpu :: spirv(
108
+ #[ spirv(
107
109
sampler, block, sampled_image, generic_image_type, // struct-only
108
110
vertex, // fn-only
109
111
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
110
112
) ]
111
113
type _TyAlias = ( ) ;
112
114
113
- #[ rust_gpu :: spirv(
115
+ #[ spirv(
114
116
sampler, block, sampled_image, generic_image_type, // struct-only
115
117
vertex, // fn-only
116
118
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -121,19 +123,19 @@ fn _opaque_ty_definer() -> _OpaqueTy {
121
123
( )
122
124
}
123
125
124
- #[ rust_gpu :: spirv(
126
+ #[ spirv(
125
127
sampler, block, sampled_image, generic_image_type, // struct-only
126
128
vertex, // fn-only
127
129
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
128
130
) ]
129
131
enum _Enum {
130
- #[ rust_gpu :: spirv(
132
+ #[ spirv(
131
133
sampler, block, sampled_image, generic_image_type, // struct-only
132
134
vertex, // fn-only
133
135
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
134
136
) ]
135
137
_Variant {
136
- #[ rust_gpu :: spirv(
138
+ #[ spirv(
137
139
sampler, block, sampled_image, generic_image_type, // struct-only
138
140
vertex, // fn-only
139
141
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -142,148 +144,148 @@ enum _Enum {
142
144
} ,
143
145
}
144
146
145
- #[ rust_gpu :: spirv(
147
+ #[ spirv(
146
148
sampler, block, sampled_image, generic_image_type, // struct-only
147
149
vertex, // fn-only
148
150
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
149
151
) ]
150
152
union _Union {
151
- #[ rust_gpu :: spirv(
153
+ #[ spirv(
152
154
sampler, block, sampled_image, generic_image_type, // struct-only
153
155
vertex, // fn-only
154
156
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
155
157
) ]
156
158
_field : ( ) ,
157
159
}
158
160
159
- #[ rust_gpu :: spirv(
161
+ #[ spirv(
160
162
vertex, // fn-only
161
163
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
162
164
) ]
163
165
struct _Struct {
164
- #[ rust_gpu :: spirv(
166
+ #[ spirv(
165
167
sampler, block, sampled_image, generic_image_type, // struct-only
166
168
vertex, // fn-only
167
169
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
168
170
) ]
169
171
_field : ( ) ,
170
172
}
171
173
172
- #[ rust_gpu :: spirv(
174
+ #[ spirv(
173
175
sampler, block, sampled_image, generic_image_type, // struct-only
174
176
vertex, // fn-only
175
177
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
176
178
) ]
177
179
impl _Struct {
178
- #[ rust_gpu :: spirv(
180
+ #[ spirv(
179
181
sampler, block, sampled_image, generic_image_type, // struct-only
180
182
vertex, // fn-only
181
183
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
182
184
) ]
183
185
const _INHERENT_ASSOC_CONST: ( ) = ( ) ;
184
186
185
- #[ rust_gpu :: spirv(
187
+ #[ spirv(
186
188
sampler, block, sampled_image, generic_image_type, // struct-only
187
189
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
188
190
) ]
189
191
fn _inherent_method ( ) { }
190
192
}
191
193
192
- #[ rust_gpu :: spirv(
194
+ #[ spirv(
193
195
sampler, block, sampled_image, generic_image_type, // struct-only
194
196
vertex, // fn-only
195
197
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
196
198
) ]
197
199
trait _TraitAlias = Copy ;
198
200
199
- #[ rust_gpu :: spirv(
201
+ #[ spirv(
200
202
sampler, block, sampled_image, generic_image_type, // struct-only
201
203
vertex, // fn-only
202
204
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
203
205
) ]
204
206
trait _Trait {
205
- #[ rust_gpu :: spirv(
207
+ #[ spirv(
206
208
sampler, block, sampled_image, generic_image_type, // struct-only
207
209
vertex, // fn-only
208
210
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
209
211
) ]
210
212
type _AssocTy ;
211
213
212
- #[ rust_gpu :: spirv(
214
+ #[ spirv(
213
215
sampler, block, sampled_image, generic_image_type, // struct-only
214
216
vertex, // fn-only
215
217
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
216
218
) ]
217
219
const _TRAIT_ASSOC_CONST: ( ) ;
218
220
219
- #[ rust_gpu :: spirv(
221
+ #[ spirv(
220
222
sampler, block, sampled_image, generic_image_type, // struct-only
221
223
vertex, // fn-only
222
224
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
223
225
) ]
224
226
fn _trait_method ( ) ;
225
227
226
- #[ rust_gpu :: spirv(
228
+ #[ spirv(
227
229
sampler, block, sampled_image, generic_image_type, // struct-only
228
230
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
229
231
) ]
230
232
fn _trait_method_with_default ( ) { }
231
233
}
232
234
233
- #[ rust_gpu :: spirv(
235
+ #[ spirv(
234
236
sampler, block, sampled_image, generic_image_type, // struct-only
235
237
vertex, // fn-only
236
238
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
237
239
) ]
238
240
impl _Trait for ( ) {
239
- #[ rust_gpu :: spirv(
241
+ #[ spirv(
240
242
sampler, block, sampled_image, generic_image_type, // struct-only
241
243
vertex, // fn-only
242
244
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
243
245
) ]
244
246
type _AssocTy = ( ) ;
245
247
246
- #[ rust_gpu :: spirv(
248
+ #[ spirv(
247
249
sampler, block, sampled_image, generic_image_type, // struct-only
248
250
vertex, // fn-only
249
251
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
250
252
) ]
251
253
const _TRAIT_ASSOC_CONST: ( ) = ( ) ;
252
254
253
- #[ rust_gpu :: spirv(
255
+ #[ spirv(
254
256
sampler, block, sampled_image, generic_image_type, // struct-only
255
257
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
256
258
) ]
257
259
fn _trait_method ( ) { }
258
260
}
259
261
260
- #[ rust_gpu :: spirv(
262
+ #[ spirv(
261
263
sampler, block, sampled_image, generic_image_type, // struct-only
262
264
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
263
265
) ]
264
266
fn _fn(
265
- #[ rust_gpu :: spirv(
267
+ #[ spirv(
266
268
sampler, block, sampled_image, generic_image_type, // struct-only
267
269
vertex, // fn-only
268
270
) ]
269
271
_entry_param : ( ) ,
270
272
) {
271
- #[ rust_gpu :: spirv(
273
+ #[ spirv(
272
274
sampler, block, sampled_image, generic_image_type, // struct-only
273
275
vertex, // fn-only
274
276
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
275
277
) ]
276
278
let _statement = ( ) ;
277
279
278
- let _closure = #[ rust_gpu :: spirv (
280
+ let _closure = #[ spirv (
279
281
sampler, block, sampled_image, generic_image_type, // struct-only
280
282
vertex, // fn-only
281
283
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
282
284
) ]
283
285
|| { } ;
284
286
285
287
(
286
- #[ rust_gpu :: spirv(
288
+ #[ spirv(
287
289
sampler, block, sampled_image, generic_image_type, // struct-only
288
290
vertex, // fn-only
289
291
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -293,7 +295,7 @@ fn _fn(
293
295
) ;
294
296
295
297
match ( ) {
296
- #[ rust_gpu :: spirv(
298
+ #[ spirv(
297
299
sampler, block, sampled_image, generic_image_type, // struct-only
298
300
vertex, // fn-only
299
301
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
@@ -303,17 +305,17 @@ fn _fn(
303
305
}
304
306
305
307
fn _fn_with_generics<
306
- #[ rust_gpu :: spirv(
308
+ #[ spirv(
307
309
sampler, block, sampled_image, generic_image_type, // struct-only
308
310
vertex, // fn-only
309
311
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
310
312
) ] ' _lifetime_param,
311
- #[ rust_gpu :: spirv(
313
+ #[ spirv(
312
314
sampler, block, sampled_image, generic_image_type, // struct-only
313
315
vertex, // fn-only
314
316
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
315
317
) ] _TyParam,
316
- #[ rust_gpu :: spirv (
318
+ #[ spirv (
317
319
sampler, block, sampled_image, generic_image_type, // struct-only
318
320
vertex, // fn-only
319
321
uniform, position, descriptor_set = 0 , binding = 0 , flat, invariant, // param-only
0 commit comments