Skip to content

Extend metadata to items, not just crates #487

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

Closed
brson opened this issue Jun 14, 2011 · 1 comment
Closed

Extend metadata to items, not just crates #487

brson opened this issue Jun 14, 2011 · 1 comment
Assignees
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@brson
Copy link
Contributor

brson commented Jun 14, 2011

Crates support attributes through the meta statement. To support conditional compilation, among other things, we want to allow attributes on all items.

Instead of using the meta statement, attributes will be applied using syntaxes like the following

#[foo]
mod bar { }
#[foo(10)]
mod bar { }
#[foo = "bar"]
mod baz { }

Maybe even something like

#[foo = "bar", baz]
mod qux { }

To support applying attributes to crates, attributes can be applied to their containing item by following them with a semicolon:

mod foo {
  #[bar];
}
@ghost ghost assigned brson Jun 14, 2011
brson added a commit that referenced this issue Jun 15, 2011
brson added a commit that referenced this issue Jun 15, 2011
brson added a commit that referenced this issue Jun 15, 2011
Right now the only thing that it adds to meta_item is an indication of whether
the attribute was declared inside or outside the item, but I expect it will
become more useful.

Issue #487
brson added a commit that referenced this issue Jun 15, 2011
brson added a commit that referenced this issue Jun 15, 2011
I don't currently know how to deal with syntax extensions that appear betweeen
an attribute and an item, so this test captures the error that occurs.

Issue #487
brson added a commit that referenced this issue Jun 16, 2011
brson added a commit that referenced this issue Jun 16, 2011
brson added a commit that referenced this issue Jun 17, 2011
brson added a commit that referenced this issue Jun 17, 2011
The pretty-printer needs access to the crate attributes in order to reproduce
inner crate attributes in standalone .rs files

Issue #487
brson added a commit that referenced this issue Jun 17, 2011
brson added a commit that referenced this issue Jun 17, 2011
This mechanism was not being used for anything. Issue #487.
brson added a commit that referenced this issue Jun 17, 2011
This is a transitional patch for converting from 'meta' to attributes.

Issue #487
brson added a commit that referenced this issue Jun 19, 2011
brson added a commit that referenced this issue Jun 19, 2011
brson added a commit that referenced this issue Jun 22, 2011
Examples: #[test], #[link(name = "vers")]

Issue #487
brson added a commit that referenced this issue Jun 28, 2011
The meta items within a crate's link attribute are used in linkage:

 #[link(name = "std",
        vers = "1.0",
        custom = "whatever")];

Name and vers are treated specially, and everything else is hashed together
into the crate meta hash.

Issue #487
brson added a commit that referenced this issue Jun 28, 2011
brson added a commit that referenced this issue Jun 29, 2011
brson added a commit that referenced this issue Jul 1, 2011
@brson
Copy link
Contributor Author

brson commented Jul 1, 2011

Closing this. Will open new issues for the remaining work.

@brson brson closed this as completed Jul 1, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Conflicts:
    .github/workflows/ci.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

1 participant