diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2014-12-31 20:43:46 -0800 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2015-01-05 18:21:13 -0800 |
| commit | 60be2f52d2434dfbf2df7728454d572d76f58bf8 (patch) | |
| tree | b6ebc58ca4d544ed39d224c4eaf0f80b900066f9 /src/libsyntax | |
| parent | f314e2c4ea48c2027e627fdfca821bb6e0012e59 (diff) | |
| download | rust-60be2f52d2434dfbf2df7728454d572d76f58bf8.tar.gz rust-60be2f52d2434dfbf2df7728454d572d76f58bf8.zip | |
Replace #[phase] with #[plugin] / #[macro_use] / #[no_link]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 28 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/std_inject.rs | 18 |
3 files changed, 17 insertions, 38 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f8ac34cfe29..e41fef4e778 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -44,7 +44,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("non_ascii_idents", Active), ("thread_local", Active), ("link_args", Active), - ("phase", Active), + ("phase", Active), // NOTE(stage0): switch to Removed after next snapshot ("plugin_registrar", Active), ("log_syntax", Active), ("trace_macros", Active), @@ -74,6 +74,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("if_let", Accepted), ("while_let", Accepted), + ("plugin", Active), + // A temporary feature gate used to enable parser extensions needed // to bootstrap fix for #5723. ("issue_5723_bootstrap", Accepted), @@ -163,22 +165,6 @@ struct MacroVisitor<'a> { } impl<'a, 'v> Visitor<'v> for MacroVisitor<'a> { - fn visit_view_item(&mut self, i: &ast::ViewItem) { - match i.node { - ast::ViewItemExternCrate(..) => { - for attr in i.attrs.iter() { - if attr.name().get() == "phase"{ - self.context.gate_feature("phase", attr.span, - "compile time crate loading is \ - experimental and possibly buggy"); - } - } - }, - _ => { } - } - visit::walk_view_item(self, i) - } - fn visit_mac(&mut self, macro: &ast::Mac) { let ast::MacInvocTT(ref path, _, _) = macro.node; let id = path.segments.last().unwrap().identifier; @@ -241,10 +227,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } ast::ViewItemExternCrate(..) => { for attr in i.attrs.iter() { - if attr.name().get() == "phase"{ - self.gate_feature("phase", attr.span, - "compile time crate loading is \ - experimental and possibly buggy"); + if attr.check_name("plugin") { + self.gate_feature("plugin", attr.span, + "compiler plugins are experimental \ + and possibly buggy"); } } } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 0503d88cca2..774a9f61cf9 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -31,11 +31,18 @@ extern crate arena; extern crate fmt_macros; -#[phase(plugin, link)] extern crate log; extern crate serialize; extern crate term; extern crate libc; +#[cfg(stage0)] +#[phase(plugin, link)] +extern crate log; + +#[cfg(not(stage0))] +#[macro_use] +extern crate log; + extern crate "serialize" as rustc_serialize; // used by deriving pub mod util { diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 5a4d0cc3bd8..4ef7eb97a21 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -65,12 +65,8 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> { Some((actual_crate_name, ast::CookedStr)), ast::DUMMY_NODE_ID), attrs: vec!( - attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_list_item( - InternedString::new("phase"), - vec!( - attr::mk_word_item(InternedString::new("plugin")), - attr::mk_word_item(InternedString::new("link") - ))))), + attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item( + InternedString::new("macro_use")))), vis: ast::Inherited, span: DUMMY_SP }); @@ -82,16 +78,6 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> { // don't add #![no_std] here, that will block the prelude injection later. // Add it during the prelude injection instead. - // Add #![feature(phase)] here, because we use #[phase] on extern crate std. - let feat_phase_attr = attr::mk_attr_inner(attr::mk_attr_id(), - attr::mk_list_item( - InternedString::new("feature"), - vec![attr::mk_word_item(InternedString::new("phase"))], - )); - // std_inject runs after feature checking so manually mark this attr - attr::mark_used(&feat_phase_attr); - krate.attrs.push(feat_phase_attr); - krate } } |
