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