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/test/auxiliary/plugin_args.rs | |
| parent | 0ba9e1fa52627404a1e5b90f745f96a872a0c564 (diff) | |
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/test/auxiliary/plugin_args.rs')
| -rw-r--r-- | src/test/auxiliary/plugin_args.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/test/auxiliary/plugin_args.rs b/src/test/auxiliary/plugin_args.rs index 6779cf997c1..907d80b50db 100644 --- a/src/test/auxiliary/plugin_args.rs +++ b/src/test/auxiliary/plugin_args.rs @@ -27,7 +27,7 @@ use syntax::ptr::P; use rustc::plugin::Registry; struct Expander { - args: P<ast::MetaItem>, + args: Vec<P<ast::MetaItem>>, } impl TTMacroExpander for Expander { @@ -35,10 +35,9 @@ impl TTMacroExpander for Expander { ecx: &'cx mut ExtCtxt, sp: Span, _: &[ast::TokenTree]) -> Box<MacResult+'cx> { - - let attr = ecx.attribute(sp, self.args.clone()); - let src = pprust::attribute_to_string(&attr); - let interned = token::intern_and_get_ident(&src); + let args = self.args.iter().map(|i| pprust::meta_item_to_string(&*i)) + .collect::<Vec<_>>().connect(", "); + let interned = token::intern_and_get_ident(&args[]); MacExpr::new(ecx.expr_str(sp, interned)) } } |
