@@ -267,25 +267,10 @@ pub fn check_builtin_meta_item(
267
267
deny_unsafety : bool ,
268
268
) {
269
269
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
289
274
| sym:: may_dangle
290
275
| sym:: rustc_as_ptr
291
276
| sym:: rustc_pub_transparent
@@ -310,11 +295,24 @@ fn emit_malformed_attribute(
310
295
| sym:: link_section
311
296
| sym:: rustc_layout_scalar_valid_range_start
312
297
| 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) ;
316
306
}
307
+ }
317
308
309
+ fn emit_malformed_attribute (
310
+ psess : & ParseSess ,
311
+ style : ast:: AttrStyle ,
312
+ span : Span ,
313
+ name : Symbol ,
314
+ template : AttributeTemplate ,
315
+ ) {
318
316
// Some of previously accepted forms were used in practice,
319
317
// report them as warnings for now.
320
318
let should_warn =
0 commit comments