rust/tests/ui/lint/inline-exported.stderr
Noratrieb 1aed58ceb6 Emit unused_attributes for #[inline] on exported functions
I saw someone post a code sample that contained these two attributes,
which immediately made me suspicious.
My suspicions were confirmed when I did a small test and checked the
compiler source code to confirm that in these cases, `#[inline]` is
indeed ignored (because you can't exactly `LocalCopy`an unmangled symbol
since that would lead to duplicate symbols, and doing a mix of an
unmangled `GloballyShared` and mangled `LocalCopy` instantiation is too
complicated for our current instatiation mode logic, which I don't want
to change right now).

So instead, emit the usual unused attribute lint with a message saying
that the attribute is ignored in this position.

I think this is not 100% true, since I expect LLVM `inlinehint` to still
be applied to such a function, but that's not why people use this
attribute, they use it for the `LocalCopy` instantiation mode, where it
doesn't work.
2025-03-24 20:07:35 +01:00

31 lines
929 B
Text

error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:10:1
|
LL | #[inline]
| ^^^^^^^^^
|
= help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
note: the lint level is defined here
--> $DIR/inline-exported.rs:8:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:15:1
|
LL | #[inline]
| ^^^^^^^^^
|
= help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:20:1
|
LL | #[inline]
| ^^^^^^^^^
|
= help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
error: aborting due to 3 previous errors