Skip to content

Commit fd2a462

Browse files
committed
Port #[link_ordinal] to the new attribute parsing infrastructure.
1 parent 1624463 commit fd2a462

File tree

1 file changed

+2
-53
lines changed

1 file changed

+2
-53
lines changed

compiler/rustc_parse/src/validate_attr.rs

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -266,59 +266,7 @@ pub fn check_builtin_meta_item(
266266
template: AttributeTemplate,
267267
deny_unsafety: bool,
268268
) {
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
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::path
308-
| sym::ignore
309-
| sym::must_use
310-
| sym::track_caller
311-
| sym::link_ordinal
312-
| sym::link_name
313-
| sym::export_name
314-
| sym::rustc_macro_transparency
315-
| sym::link_section
316-
| sym::rustc_layout_scalar_valid_range_start
317-
| sym::rustc_layout_scalar_valid_range_end
318-
| sym::no_implicit_prelude
319-
) {
320-
return;
321-
// attrs with new parsers are locally validated so excluded here
269+
if !is_attr_template_compatible(&template, &meta.kind) {// attrs with new parsers are locally validated so excluded here
322270
if matches!(
323271
name,
324272
sym::inline
@@ -345,6 +293,7 @@ fn emit_malformed_attribute(
345293
| sym::must_use
346294
| sym::track_caller
347295
| sym::link_name
296+
| sym::link_ordinal
348297
| sym::export_name
349298
| sym::rustc_macro_transparency
350299
| sym::link_section

0 commit comments

Comments
 (0)