-
Notifications
You must be signed in to change notification settings - Fork 492
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
Add "Attributes on X" for various places attributes are allowed #355
Comments
@Centril had the idea of using a template on each attribute which would include a list of places where the attribute is valid (and the Syntax):
Allowed on: any item Once we have the information where every attribute is valid, it might be worth considering adding this. I have concerns that many of the attributes locations are not validated, and are allowed everywhere even if they are ignored. Or the behavior of some attributes that are applicable in many places (like Another example is |
This is something that I personally intend to fix eventually, similarly to rust-lang/rust#57321 that did it for attribute inputs rather than locations. |
@petrochenkov Yeah that's pretty fair... Maybe we can document them on an issue on this repo for now with an explicit caveat re. that they may change? You'll need to know what the current behaviors are and what we think they should be to fix them in any case? And when you are done with fixing we can move them into the reference? |
I think it would be reasonable to list location in which the attribute should certainly be allowed, and keep silence about other locations. |
Some more validation was added via rust-lang/rust#73461, which can help guide updating the docs on where each attribute can be placed. |
More validation is being considered in rust-lang/rust#80920. I noticed that |
I noticed, that if // llvm-objdump output has `.example_section:`
#[link_section = ".example_section"]
pub static VAR1: u32 = 1; But for a function, if // llvm-objdump output does not have `.example_section:`
#[link_section = ".example_section"]
pub fn foo() {}
// llvm-objdump output has `.example_section:`
#[no_mangle]
#[link_section = ".example_section"]
pub fn foo() {} |
Various places allow attributes. We document where on the attributes page already, but each individual page for those places should also have documentation about what they allow.
The text was updated successfully, but these errors were encountered: