-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html
Description
Currently, its not possible to write a custom attribute that applies to the crate, due to the way syntax extensions and the module system works.
- This does not work because inner attributes have to go first an a module body:
// crate.rs
#![feature(phase)]
#[phase(plugin)]
extern crate foo;
#![foo] // ERROR: An inner attribute is not permitted in this context
- This does not work because the attribute gets only loaded after it got used:
// crate.rs
#![feature(phase)]
#![foo] // Gets ignored because the syntax extension did not yet get loaded
#[phase(plugin)]
extern crate foo;
Possible solutions
- Lift the ordering restriction between items.
- Make plugins mutual recursive visible, like regular items.
Metadata
Metadata
Assignees
Labels
A-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html