From 5bf5e7116099d85a99d047cfa43db155074e594a Mon Sep 17 00:00:00 2001 From: Reuben Cruise Date: Thu, 25 Sep 2025 16:11:34 +0100 Subject: 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. --- tests/ui/force-inlining/inherent.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/force-inlining/inherent.rs (limited to 'tests/ui/force-inlining/inherent.rs') diff --git a/tests/ui/force-inlining/inherent.rs b/tests/ui/force-inlining/inherent.rs new file mode 100644 index 00000000000..25c76eaf37a --- /dev/null +++ b/tests/ui/force-inlining/inherent.rs @@ -0,0 +1,21 @@ +//@ check-fail +#![feature(rustc_attrs)] + +struct Foo; + +impl Foo { + #[rustc_force_inline] + //~^ ERROR: `Foo::bar` is incompatible with `#[rustc_force_inline]` + #[rustc_no_mir_inline] + fn bar() {} +} + +fn bar_caller() { + unsafe { + Foo::bar(); + } +} + +fn main() { + bar_caller(); +} -- cgit 1.4.1-3-g733a5