diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-06 13:56:38 -0800 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-09 13:27:27 -0800 |
| commit | 93b642d9743edea728ef08b2d6fd17229caaad43 (patch) | |
| tree | b88ec4e6fac283b95735e7c34dac6760e53a2874 /src/doc/reference.md | |
| parent | 0ba9e1fa52627404a1e5b90f745f96a872a0c564 (diff) | |
| download | rust-93b642d9743edea728ef08b2d6fd17229caaad43.tar.gz rust-93b642d9743edea728ef08b2d6fd17229caaad43.zip | |
Use a crate attribute to load plugins
#[plugin] #[no_link] extern crate bleh;
becomes a crate attribute
#![plugin(bleh)]
The feature gate is still required.
It's almost never correct to link a plugin into the resulting library /
executable, because it will bring all of libsyntax and librustc with it.
However if you really want this behavior, you can get it with a separate
`extern crate` item in addition to the `plugin` attribute.
Fixes #21043.
Fixes #20769.
[breaking-change]
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 9c8191a386d..999efc95c0e 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2014,6 +2014,11 @@ type int8_t = i8; - `no_start` - disable linking to the `native` crate, which specifies the "start" language item. - `no_std` - disable linking to the `std` crate. +- `plugin` — load a list of named crates as compiler plugins, e.g. + `#![plugin(foo, bar)]`. Optional arguments for each plugin, + i.e. `#![plugin(foo(... args ...))]`, are provided to the plugin's + registrar function. The `plugin` feature gate is required to use + this attribute. ### Module-only attributes @@ -2082,7 +2087,7 @@ On `struct`s: remove any padding between fields (note that this is very fragile and may break platforms which require aligned access). -### Macro- and plugin-related attributes +### Macro-related attributes - `macro_use` on a `mod` — macros defined in this module will be visible in the module's parent, after this module has been included. @@ -2097,13 +2102,8 @@ On `struct`s: - `macro_export` - export a macro for cross-crate usage. -- `plugin` on an `extern crate` — load this crate as a [compiler - plugin][plugin]. The `plugin` feature gate is required. Any arguments to - the attribute, e.g. `#[plugin=...]` or `#[plugin(...)]`, are provided to the - plugin. - -- `no_link` on an `extern crate` — even if we load this crate for macros or - compiler plugins, don't link it into the output. +- `no_link` on an `extern crate` — even if we load this crate for macros, don't + link it into the output. See the [macros section of the book](book/macros.html#scoping-and-macro-import/export) for more information on |
