about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorReuben Cruise <reuben.cruise@arm.com>2025-09-25 16:11:34 +0100
committerReuben Cruise <reuben.cruise@arm.com>2025-10-02 11:30:11 +0100
commit5bf5e7116099d85a99d047cfa43db155074e594a (patch)
treea486a482df041b66dafc4d44b40b77dd43830e1a /compiler
parentcaccb4d0368bd918ef6668af8e13834d07040417 (diff)
downloadrust-5bf5e7116099d85a99d047cfa43db155074e594a.tar.gz
rust-5bf5e7116099d85a99d047cfa43db155074e594a.zip
Extends `rustc_force_inline` to inherent methods
- Changes parser to allow application to inherent methods.
- Adds tests to confirm extended functionality works just as the existing.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_attr_parsing/src/attributes/inline.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/inline.rs b/compiler/rustc_attr_parsing/src/attributes/inline.rs
index a73430c9d00..a10ad27fcc6 100644
--- a/compiler/rustc_attr_parsing/src/attributes/inline.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/inline.rs
@@ -72,7 +72,11 @@ impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
     const PATH: &'static [Symbol] = &[sym::rustc_force_inline];
     const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
     const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
+    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
+        Allow(Target::Fn),
+        Allow(Target::Method(MethodKind::Inherent)),
+    ]);
+
     const TEMPLATE: AttributeTemplate = template!(Word, List: &["reason"], NameValueStr: "reason");
 
     fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {