diff options
| author | bors <bors@rust-lang.org> | 2018-08-23 08:38:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-23 08:38:22 +0000 |
| commit | 827e57c2f69a9caad36fab189770ad0bb8957d4f (patch) | |
| tree | cbed5e86adb9884ea180e41b3b0a8bdc0a9ff673 /src/libsyntax | |
| parent | c648b0bb2b3e4f776ff6034f465d9afee622a939 (diff) | |
| parent | b34503e60ee674b31797790b2b8d8a20f1a54e48 (diff) | |
| download | rust-827e57c2f69a9caad36fab189770ad0bb8957d4f.tar.gz rust-827e57c2f69a9caad36fab189770ad0bb8957d4f.zip | |
Auto merge of #53459 - petrochenkov:stabmore, r=nrc
Stabilize a few secondary macro features - `tool_attributes` - closes https://github.com/rust-lang/rust/issues/44690 - `proc_macro_path_invoc` - this feature was created due to issues with tool attributes (https://github.com/rust-lang/rust/issues/51277), those issues are now fixed (https://github.com/rust-lang/rust/pull/52841) - partially `proc_macro_gen` - this feature was created due to issue https://github.com/rust-lang/rust/issues/50504, the issue is now fixed (https://github.com/rust-lang/rust/pull/51952), so proc macros can generate modules. They still can't generate `macro_rules` items though due to unclear hygiene interactions.
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 89763c9c06f..8b5757e382e 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -441,9 +441,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), @@ -457,8 +454,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), @@ -655,6 +650,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 |
