-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
The following code:
#[inline(always)]
fn my_func(arg: i32) {
if arg > 1 {
my_func(arg - 1);
}
}
fn main() {
my_func(10);
}
triggers the following error:
libgccjit.so: error: : inlining failed in call to ‘always_inline’ ‘_ZN9test_rust7my_func17h0d9fc1667ee3d8a0E’: function not considered for inlining
libgccjit.so: src/main.rs:4:9: note: : called from here
As noted here, always_inline
is not an optimization hint while #[inline(always)]
is a hint as noted in the reference.
I'm not sure what the equivalent would be in GCC, though.
Maybe check what clang is doing (since it also has the issue) vs what rustc
is doing.
#[rustc_force_inline]
is possibly implemented via always_inline
.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed