Resolve TODO about macro 2.0 def

This commit is contained in:
veetaha 2020-05-10 22:08:06 +03:00
parent 73c6bc4dbd
commit 2a5ab9f5dd
2 changed files with 8 additions and 14 deletions

View file

@ -2537,17 +2537,15 @@ impl MetaItem {
pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
} }
/// Macro definition. /// Macro 2.0 definition.
/// /// Their syntax is still WIP by rustc team...
/// ``` /// ```
/// ❰ /// ❰
/// macro_rules! foo { /// macro foo { }
/// ($bar:tt) => {$bar}
/// }
/// ❱ /// ❱
/// ``` /// ```
/// ///
/// [Reference](https://doc.rust-lang.org/reference/macros-by-example.html) /// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/1584-macros.md)
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct MacroDef { pub struct MacroDef {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,

View file

@ -2049,19 +2049,15 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
Path, T![=], AttrInput, nested_meta_items: [MetaItem] Path, T![=], AttrInput, nested_meta_items: [MetaItem]
} }
// TODO: is this a special case of `MacroCall` where `Name` = `macro_rules`? /// Macro 2.0 definition.
// It doesn't seem this ast node is used anywhere /// Their syntax is still WIP by rustc team...
/// Macro definition.
///
/// ``` /// ```
/// ❰ /// ❰
/// macro_rules! foo { /// macro foo { }
/// ($bar:tt) => {$bar}
/// }
/// ❱ /// ❱
/// ``` /// ```
/// ///
/// [Reference](https://doc.rust-lang.org/reference/macros-by-example.html) /// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/1584-macros.md)
struct MacroDef { struct MacroDef {
Name, TokenTree Name, TokenTree
} }