@@ -8,12 +8,12 @@ extend the compiler's behavior with new syntax extensions, lint checks, etc.
8
8
A plugin is a dynamic library crate with a designated * registrar* function that
9
9
registers extensions with ` rustc ` . Other crates can load these extensions using
10
10
the crate attribute ` #![plugin(...)] ` . See the
11
- [ ` rustc::plugin ` ] ( ../rustc/plugin /index.html ) documentation for more about the
11
+ [ ` rustc_plugin ` ] ( ../rustc_plugin /index.html ) documentation for more about the
12
12
mechanics of defining and loading a plugin.
13
13
14
14
If present, arguments passed as ` #![plugin(foo(... args ...))] ` are not
15
15
interpreted by rustc itself. They are provided to the plugin through the
16
- ` Registry ` 's [ ` args ` method] ( ../rustc/plugin /registry/struct.Registry.html#method.args ) .
16
+ ` Registry ` 's [ ` args ` method] ( ../rustc_plugin /registry/struct.Registry.html#method.args ) .
17
17
18
18
In the vast majority of cases, a plugin should * only* be used through
19
19
` #![plugin] ` and not through an ` extern crate ` item. Linking a plugin would
@@ -43,13 +43,14 @@ that implements Roman numeral integer literals.
43
43
44
44
extern crate syntax;
45
45
extern crate rustc;
46
+ extern crate rustc_plugin;
46
47
47
48
use syntax::codemap::Span;
48
49
use syntax::parse::token;
49
50
use syntax::ast::TokenTree;
50
51
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
51
52
use syntax::ext::build::AstBuilder; // trait for expr_usize
52
- use rustc::plugin ::Registry;
53
+ use rustc_plugin ::Registry;
53
54
54
55
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
55
56
-> Box<MacResult + 'static> {
@@ -120,7 +121,7 @@ The advantages over a simple `fn(&str) -> u32` are:
120
121
In addition to procedural macros, you can define new
121
122
[ ` derive ` ] ( ../reference.html#derive ) -like attributes and other kinds of
122
123
extensions. See
123
- [ ` Registry::register_syntax_extension ` ] ( ../rustc/plugin /registry/struct.Registry.html#method.register_syntax_extension )
124
+ [ ` Registry::register_syntax_extension ` ] ( ../rustc_plugin /registry/struct.Registry.html#method.register_syntax_extension )
124
125
and the [ ` SyntaxExtension `
125
126
enum] ( https://doc.rust-lang.org/syntax/ext/base/enum.SyntaxExtension.html ) . For
126
127
a more involved macro example, see
@@ -189,10 +190,11 @@ extern crate syntax;
189
190
// Load rustc as a plugin to get macros
190
191
#[macro_use]
191
192
extern crate rustc;
193
+ extern crate rustc_plugin;
192
194
193
195
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
194
196
EarlyLintPassObject, LintArray};
195
- use rustc::plugin ::Registry;
197
+ use rustc_plugin ::Registry;
196
198
use syntax::ast;
197
199
198
200
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
0 commit comments