dtolnay / linkme

Safe cross-platform linker shenanigans
Apache License 2.0
628 stars 42 forks source link

Bugfix for #[linkme] attribute when also using function element shorthand #39

Closed KaiGuenster closed 3 years ago

KaiGuenster commented 3 years ago

When using function element shorthand (attribute directly on the function) together with the #[linkme] attribute, the attribute wasn't consumed and left for the compiler to try and expand as a macro, which failed. To fix, the attribute is now consumed from the function and passed on to code generation for the static variable referencing the function. Also included is a test case for that scenario and documentation how to use the #[linkme] attribute.

Thanks for creating this library, it's incredibly helpful.

dtolnay commented 3 years ago

Published in 0.2.6.