@@ -267,25 +267,10 @@ pub fn check_builtin_meta_item(
267267 deny_unsafety : bool ,
268268) {
269269 if !is_attr_template_compatible ( & template, & meta. kind ) {
270- emit_malformed_attribute ( psess, style, meta. span , name, template) ;
271- }
272-
273- if deny_unsafety {
274- deny_builtin_meta_unsafety ( psess, meta) ;
275- }
276- }
277-
278- fn emit_malformed_attribute (
279- psess : & ParseSess ,
280- style : ast:: AttrStyle ,
281- span : Span ,
282- name : Symbol ,
283- template : AttributeTemplate ,
284- ) {
285- // attrs with new parsers are locally validated so excluded here
286- if matches ! (
287- name,
288- sym:: inline
270+ // attrs with new parsers are locally validated so excluded here
271+ if matches ! (
272+ name,
273+ sym:: inline
289274 | sym:: may_dangle
290275 | sym:: rustc_as_ptr
291276 | sym:: rustc_pub_transparent
@@ -310,11 +295,24 @@ fn emit_malformed_attribute(
310295 | sym:: link_section
311296 | sym:: rustc_layout_scalar_valid_range_start
312297 | sym:: rustc_layout_scalar_valid_range_end
313- | sym:: no_implicit_prelude
314- ) {
315- return ;
298+ | sym:: no_implicit_prelude) {
299+ return ;
300+ }
301+ emit_malformed_attribute ( psess, style, meta. span , name, template) ;
302+ }
303+
304+ if deny_unsafety {
305+ deny_builtin_meta_unsafety ( psess, meta) ;
316306 }
307+ }
317308
309+ fn emit_malformed_attribute (
310+ psess : & ParseSess ,
311+ style : ast:: AttrStyle ,
312+ span : Span ,
313+ name : Symbol ,
314+ template : AttributeTemplate ,
315+ ) {
318316 // Some of previously accepted forms were used in practice,
319317 // report them as warnings for now.
320318 let should_warn =
0 commit comments