@@ -267,6 +267,42 @@ pub fn check_builtin_meta_item(
267267 deny_unsafety : bool ,
268268) {
269269 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:: path
293+ | sym:: ignore
294+ | sym:: must_use
295+ | sym:: track_caller
296+ | sym:: link_name
297+ | sym:: export_name
298+ | sym:: rustc_macro_transparency
299+ | sym:: link_section
300+ | sym:: rustc_layout_scalar_valid_range_start
301+ | sym:: rustc_layout_scalar_valid_range_end
302+ | sym:: no_implicit_prelude
303+ ) {
304+ return ;
305+ }
270306 emit_malformed_attribute ( psess, style, meta. span , name, template) ;
271307 }
272308
@@ -282,42 +318,6 @@ fn emit_malformed_attribute(
282318 name : Symbol ,
283319 template : AttributeTemplate ,
284320) {
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-
321321 // Some of previously accepted forms were used in practice,
322322 // report them as warnings for now.
323323 let should_warn = |name| matches ! ( name, sym:: doc | sym:: link | sym:: test | sym:: bench) ;
0 commit comments