#[used]
should work on functions
#68322
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-linkage
Area: linking into static, shared libraries and binaries
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
WG-embedded
Working group: Embedded systems
Currently
#[used]
only works on static items. It would be more consistent and useful if it also worked on functions.My motivation for this is to prevent some cases of user errors when using
cortex-m-rt
's#[exception]
and#[interrupt]
attributes. As can be seen in this test, it is possible to use those inside of private modules, which results in the function never ending up in the binary.Note that
#[used]
cannot be made to work on functions that have generics in scope, since those can end up producing arbitrary monomorphizations depending on the parameters (and there's no single canonical thing that#[used]
would make show up in the binary).The text was updated successfully, but these errors were encountered: