From 93b642d9743edea728ef08b2d6fd17229caaad43 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Fri, 6 Feb 2015 13:56:38 -0800 Subject: 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] --- src/doc/reference.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/doc/reference.md') 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 -- cgit 1.4.1-3-g733a5