Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[used] should work on functions #68322

Open
jonas-schievink opened this issue Jan 17, 2020 · 0 comments
Open

#[used] should work on functions #68322

jonas-schievink opened this issue Jan 17, 2020 · 0 comments
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

Comments

@jonas-schievink
Copy link
Contributor

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).

@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries A-attributes Area: Attributes (`#[…]`, `#![…]`) T-lang Relevant to the language team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. WG-embedded Working group: Embedded systems labels Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant