Warn if a function is marked as both #[inline] and #[no_mangle] #72944
Labels
A-FFI
Area: Foreign function interface (FFI)
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code:
If the function is marked as
#[inline]
, it doesn't get compiled into the dll file:strings target/release/libfoo.so | grep foo
The reason a function may be marked as both
#[inline]
and#[no_mangle]
is so that it gets inlined when compiling the crate as a rust library, but not inlined when compiling the crate as a cdylib.There should be a warning to use something like
#[cfg_attr(not(crate_type="cdylib"), inline]
instead.This issue has been assigned to @doctorn via this comment.
The text was updated successfully, but these errors were encountered: