@@ -267,6 +267,41 @@ pub fn check_builtin_meta_item(
267
267
deny_unsafety : bool ,
268
268
) {
269
269
if !is_attr_template_compatible ( & template, & meta. kind ) {
270
+ // attrs with new parsers are locally validated so excluded here
271
+ if matches ! (
272
+ name,
273
+ sym:: inline
274
+ | sym:: may_dangle
275
+ | sym:: rustc_as_ptr
276
+ | sym:: rustc_pub_transparent
277
+ | sym:: rustc_const_stable_indirect
278
+ | sym:: rustc_force_inline
279
+ | sym:: rustc_confusables
280
+ | sym:: rustc_skip_during_method_dispatch
281
+ | sym:: rustc_pass_by_value
282
+ | sym:: repr
283
+ | sym:: align
284
+ | sym:: deprecated
285
+ | sym:: optimize
286
+ | sym:: cold
287
+ | sym:: target_feature
288
+ | sym:: rustc_allow_const_fn_unstable
289
+ | sym:: naked
290
+ | sym:: no_mangle
291
+ | sym:: non_exhaustive
292
+ | sym:: ignore
293
+ | sym:: must_use
294
+ | sym:: track_caller
295
+ | sym:: link_name
296
+ | sym:: export_name
297
+ | sym:: rustc_macro_transparency
298
+ | sym:: link_section
299
+ | sym:: rustc_layout_scalar_valid_range_start
300
+ | sym:: rustc_layout_scalar_valid_range_end
301
+ | sym:: no_implicit_prelude
302
+ ) {
303
+ return ;
304
+ }
270
305
emit_malformed_attribute ( psess, style, meta. span , name, template) ;
271
306
}
272
307
@@ -282,42 +317,6 @@ fn emit_malformed_attribute(
282
317
name : Symbol ,
283
318
template : AttributeTemplate ,
284
319
) {
285
- // attrs with new parsers are locally validated so excluded here
286
- if matches ! (
287
- name,
288
- sym:: inline
289
- | sym:: may_dangle
290
- | sym:: rustc_as_ptr
291
- | sym:: rustc_pub_transparent
292
- | sym:: rustc_const_stable_indirect
293
- | sym:: rustc_force_inline
294
- | sym:: rustc_confusables
295
- | sym:: rustc_skip_during_method_dispatch
296
- | sym:: rustc_pass_by_value
297
- | sym:: repr
298
- | sym:: align
299
- | sym:: deprecated
300
- | sym:: optimize
301
- | sym:: cold
302
- | sym:: target_feature
303
- | sym:: rustc_allow_const_fn_unstable
304
- | sym:: naked
305
- | sym:: no_mangle
306
- | sym:: non_exhaustive
307
- | sym:: ignore
308
- | sym:: must_use
309
- | sym:: track_caller
310
- | sym:: link_name
311
- | sym:: export_name
312
- | sym:: rustc_macro_transparency
313
- | sym:: link_section
314
- | sym:: rustc_layout_scalar_valid_range_start
315
- | sym:: rustc_layout_scalar_valid_range_end
316
- | sym:: no_implicit_prelude
317
- ) {
318
- return ;
319
- }
320
-
321
320
// Some of previously accepted forms were used in practice,
322
321
// report them as warnings for now.
323
322
let should_warn = |name| matches ! ( name, sym:: doc | sym:: link | sym:: test | sym:: bench) ;
0 commit comments