-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamWG-embeddedWorking group: Embedded systemsWorking group: Embedded systems
Description
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).
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamWG-embeddedWorking group: Embedded systemsWorking group: Embedded systems