diff options
| author | Reuben Cruise <reuben.cruise@arm.com> | 2025-09-25 16:11:34 +0100 |
|---|---|---|
| committer | Reuben Cruise <reuben.cruise@arm.com> | 2025-10-02 11:30:11 +0100 |
| commit | 5bf5e7116099d85a99d047cfa43db155074e594a (patch) | |
| tree | a486a482df041b66dafc4d44b40b77dd43830e1a /compiler | |
| parent | caccb4d0368bd918ef6668af8e13834d07040417 (diff) | |
| download | rust-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.rs | 6 |
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> { |
