Fix target list of link_section

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
Jonathan Brouwer
2025-10-06 22:31:38 +02:00
parent 3d8c1c1fc0
commit 4787834eda
3 changed files with 15 additions and 9 deletions

View File

@@ -467,8 +467,14 @@ impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
const PATH: &[Symbol] = &[sym::link_section]; const PATH: &[Symbol] = &[sym::link_section];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError; const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
const ALLOWED_TARGETS: AllowedTargets = const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
AllowedTargets::AllowListWarnRest(&[Allow(Target::Static), Allow(Target::Fn)]); Allow(Target::Static),
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const TEMPLATE: AttributeTemplate = template!( const TEMPLATE: AttributeTemplate = template!(
NameValueStr: "name", NameValueStr: "name",
"https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute" "https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"

View File

@@ -82,7 +82,7 @@ LL | #[link_section = "x"]
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[link_ordinal]` attribute cannot be used on macro calls warning: `#[link_ordinal]` attribute cannot be used on macro calls
--> $DIR/attr-on-mac-call.rs:33:5 --> $DIR/attr-on-mac-call.rs:33:5

View File

@@ -1236,7 +1236,7 @@ LL | #[link_section = "1800"]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[link_section]` attribute cannot be used on modules warning: `#[link_section]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:17
@@ -1245,7 +1245,7 @@ LL | mod inner { #![link_section="1800"] }
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[link_section]` attribute cannot be used on structs warning: `#[link_section]` attribute cannot be used on structs
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
@@ -1254,7 +1254,7 @@ LL | #[link_section = "1800"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[link_section]` attribute cannot be used on type aliases warning: `#[link_section]` attribute cannot be used on type aliases
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5
@@ -1263,7 +1263,7 @@ LL | #[link_section = "1800"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[link_section]` attribute cannot be used on inherent impl blocks warning: `#[link_section]` attribute cannot be used on inherent impl blocks
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5
@@ -1272,7 +1272,7 @@ LL | #[link_section = "1800"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[must_use]` attribute cannot be used on modules warning: `#[must_use]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:1
@@ -1572,7 +1572,7 @@ LL | #![link_section = "1800"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions = help: `#[link_section]` can be applied to functions and statics
warning: `#[must_use]` attribute cannot be used on crates warning: `#[must_use]` attribute cannot be used on crates
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1