diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-18 00:52:34 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-23 01:13:17 +0300 |
| commit | b34503e60ee674b31797790b2b8d8a20f1a54e48 (patch) | |
| tree | c4123ae60902eb6a225a264e16bc8ce4115fcfd7 /src/libsyntax | |
| parent | b75b0471a8b87c44e0bd953d2a5c36d896128723 (diff) | |
| download | rust-b34503e60ee674b31797790b2b8d8a20f1a54e48.tar.gz rust-b34503e60ee674b31797790b2b8d8a20f1a54e48.zip | |
Stabilize a few secondary macro features
`tool_attributes`, `proc_macro_path_invoc`, partially `proc_macro_gen`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 15 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 9 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 97279e00869..494f6d29832 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -666,30 +666,25 @@ impl<'a, 'b> MacroExpander<'a, 'b> { None => return, }; - fragment.visit_with(&mut DisallowModules { + fragment.visit_with(&mut DisallowMacros { span, parse_sess: self.cx.parse_sess, }); - struct DisallowModules<'a> { + struct DisallowMacros<'a> { span: Span, parse_sess: &'a ParseSess, } - impl<'ast, 'a> Visitor<'ast> for DisallowModules<'a> { + impl<'ast, 'a> Visitor<'ast> for DisallowMacros<'a> { fn visit_item(&mut self, i: &'ast ast::Item) { - let name = match i.node { - ast::ItemKind::Mod(_) => Some("modules"), - ast::ItemKind::MacroDef(_) => Some("macro definitions"), - _ => None, - }; - if let Some(name) = name { + if let ast::ItemKind::MacroDef(_) = i.node { emit_feature_err( self.parse_sess, "proc_macro_gen", self.span, GateIssue::Language, - &format!("procedural macros cannot expand to {}", name), + &format!("procedural macros cannot expand to macro definitions"), ); } visit::walk_item(self, i); diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 71ad118ed8e..5e569025ab3 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -438,9 +438,6 @@ declare_features! ( (active, tbm_target_feature, "1.27.0", Some(44839), None), (active, wasm_target_feature, "1.30.0", Some(44839), None), - // Allows macro invocations of the form `#[foo::bar]` - (active, proc_macro_path_invoc, "1.27.0", Some(38356), None), - // Allows macro invocations on modules expressions and statements and // procedural macros to expand to non-items. (active, proc_macro_mod, "1.27.0", Some(38356), None), @@ -454,8 +451,6 @@ declare_features! ( // Access to crate names passed via `--extern` through prelude (active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)), - // Scoped attributes - (active, tool_attributes, "1.25.0", Some(44690), None), // Scoped lints (active, tool_lints, "1.28.0", Some(44690), None), @@ -652,6 +647,10 @@ declare_features! ( (accepted, use_extern_macros, "1.30.0", Some(35896), None), // Allows keywords to be escaped for use as identifiers (accepted, raw_identifiers, "1.30.0", Some(48589), None), + // Attributes scoped to tools + (accepted, tool_attributes, "1.30.0", Some(44690), None), + // Allows multi-segment paths in attributes and derives + (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None), ); // If you change this, please modify src/doc/unstable-book as well. You must |
