diff options
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/item_tree.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_def/src/item_tree/lower.rs | 6 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/syntax_kind/generated.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 124 | ||||
-rw-r--r-- | xtask/src/ast_src.rs | 2 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 8 |
8 files changed, 75 insertions, 75 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index c33b645f3..bfd574c5d 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -671,7 +671,7 @@ impl ExprCollector<'_> { | |||
671 | ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks | 671 | ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks |
672 | ast::Item::ImplDef(_) | 672 | ast::Item::ImplDef(_) |
673 | | ast::Item::UseItem(_) | 673 | | ast::Item::UseItem(_) |
674 | | ast::Item::ExternCrateItem(_) | 674 | | ast::Item::ExternCrate(_) |
675 | | ast::Item::Module(_) | 675 | | ast::Item::Module(_) |
676 | | ast::Item::MacroCall(_) => return None, | 676 | | ast::Item::MacroCall(_) => return None, |
677 | }; | 677 | }; |
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index 615c1e14c..4db7b2793 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -412,7 +412,7 @@ macro_rules! mod_items { | |||
412 | 412 | ||
413 | mod_items! { | 413 | mod_items! { |
414 | Import in imports -> ast::UseItem, | 414 | Import in imports -> ast::UseItem, |
415 | ExternCrate in extern_crates -> ast::ExternCrateItem, | 415 | ExternCrate in extern_crates -> ast::ExternCrate, |
416 | Function in functions -> ast::FnDef, | 416 | Function in functions -> ast::FnDef, |
417 | Struct in structs -> ast::StructDef, | 417 | Struct in structs -> ast::StructDef, |
418 | Union in unions -> ast::UnionDef, | 418 | Union in unions -> ast::UnionDef, |
@@ -492,7 +492,7 @@ pub struct ExternCrate { | |||
492 | pub visibility: RawVisibilityId, | 492 | pub visibility: RawVisibilityId, |
493 | /// Whether this is a `#[macro_use] extern crate ...`. | 493 | /// Whether this is a `#[macro_use] extern crate ...`. |
494 | pub is_macro_use: bool, | 494 | pub is_macro_use: bool, |
495 | pub ast_id: FileAstId<ast::ExternCrateItem>, | 495 | pub ast_id: FileAstId<ast::ExternCrate>, |
496 | } | 496 | } |
497 | 497 | ||
498 | #[derive(Debug, Clone, Eq, PartialEq)] | 498 | #[derive(Debug, Clone, Eq, PartialEq)] |
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 6c58c6378..8a36de311 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -95,7 +95,7 @@ impl Ctx { | |||
95 | ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} | 95 | ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} |
96 | 96 | ||
97 | // These don't have inner items. | 97 | // These don't have inner items. |
98 | ast::Item::Module(_) | ast::Item::ExternCrateItem(_) | ast::Item::UseItem(_) => {} | 98 | ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::UseItem(_) => {} |
99 | }; | 99 | }; |
100 | 100 | ||
101 | let attrs = Attrs::new(item, &self.hygiene); | 101 | let attrs = Attrs::new(item, &self.hygiene); |
@@ -113,7 +113,7 @@ impl Ctx { | |||
113 | ast::Item::UseItem(ast) => Some(ModItems( | 113 | ast::Item::UseItem(ast) => Some(ModItems( |
114 | self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), | 114 | self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), |
115 | )), | 115 | )), |
116 | ast::Item::ExternCrateItem(ast) => self.lower_extern_crate(ast).map(Into::into), | 116 | ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into), |
117 | ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), | 117 | ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), |
118 | ast::Item::ExternBlock(ast) => { | 118 | ast::Item::ExternBlock(ast) => { |
119 | Some(ModItems(self.lower_extern_block(ast).into_iter().collect::<SmallVec<_>>())) | 119 | Some(ModItems(self.lower_extern_block(ast).into_iter().collect::<SmallVec<_>>())) |
@@ -498,7 +498,7 @@ impl Ctx { | |||
498 | 498 | ||
499 | fn lower_extern_crate( | 499 | fn lower_extern_crate( |
500 | &mut self, | 500 | &mut self, |
501 | extern_crate: &ast::ExternCrateItem, | 501 | extern_crate: &ast::ExternCrate, |
502 | ) -> Option<FileItemTreeId<ExternCrate>> { | 502 | ) -> Option<FileItemTreeId<ExternCrate>> { |
503 | let path = ModPath::from_name_ref(&extern_crate.name_ref()?); | 503 | let path = ModPath::from_name_ref(&extern_crate.name_ref()?); |
504 | let alias = extern_crate.rename().map(|a| { | 504 | let alias = extern_crate.rename().map(|a| { |
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index ffcdaaa99..3b73e5346 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -313,7 +313,7 @@ fn extern_crate_item(p: &mut Parser, m: Marker) { | |||
313 | 313 | ||
314 | opt_alias(p); | 314 | opt_alias(p); |
315 | p.expect(T![;]); | 315 | p.expect(T![;]); |
316 | m.complete(p, EXTERN_CRATE_ITEM); | 316 | m.complete(p, EXTERN_CRATE); |
317 | } | 317 | } |
318 | 318 | ||
319 | pub(crate) fn extern_item_list(p: &mut Parser) { | 319 | pub(crate) fn extern_item_list(p: &mut Parser) { |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index f14b60b65..116b58858 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -128,7 +128,7 @@ pub enum SyntaxKind { | |||
128 | ENUM_DEF, | 128 | ENUM_DEF, |
129 | FN_DEF, | 129 | FN_DEF, |
130 | RET_TYPE, | 130 | RET_TYPE, |
131 | EXTERN_CRATE_ITEM, | 131 | EXTERN_CRATE, |
132 | MODULE, | 132 | MODULE, |
133 | USE_ITEM, | 133 | USE_ITEM, |
134 | STATIC_DEF, | 134 | STATIC_DEF, |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 01e8111b0..3fd761367 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -65,12 +65,12 @@ impl ExternBlock { | |||
65 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | 65 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } |
66 | } | 66 | } |
67 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 67 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
68 | pub struct ExternCrateItem { | 68 | pub struct ExternCrate { |
69 | pub(crate) syntax: SyntaxNode, | 69 | pub(crate) syntax: SyntaxNode, |
70 | } | 70 | } |
71 | impl ast::AttrsOwner for ExternCrateItem {} | 71 | impl ast::AttrsOwner for ExternCrate {} |
72 | impl ast::VisibilityOwner for ExternCrateItem {} | 72 | impl ast::VisibilityOwner for ExternCrate {} |
73 | impl ExternCrateItem { | 73 | impl ExternCrate { |
74 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | 74 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } |
75 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 75 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
76 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 76 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
@@ -255,6 +255,21 @@ impl ItemList { | |||
255 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 255 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
256 | } | 256 | } |
257 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 257 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
258 | pub struct NameRef { | ||
259 | pub(crate) syntax: SyntaxNode, | ||
260 | } | ||
261 | impl NameRef { | ||
262 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
263 | } | ||
264 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
265 | pub struct Rename { | ||
266 | pub(crate) syntax: SyntaxNode, | ||
267 | } | ||
268 | impl ast::NameOwner for Rename {} | ||
269 | impl Rename { | ||
270 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
271 | } | ||
272 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
258 | pub struct Abi { | 273 | pub struct Abi { |
259 | pub(crate) syntax: SyntaxNode, | 274 | pub(crate) syntax: SyntaxNode, |
260 | } | 275 | } |
@@ -699,13 +714,6 @@ impl MethodCallExpr { | |||
699 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 714 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
700 | } | 715 | } |
701 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 716 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
702 | pub struct NameRef { | ||
703 | pub(crate) syntax: SyntaxNode, | ||
704 | } | ||
705 | impl NameRef { | ||
706 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
707 | } | ||
708 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
709 | pub struct TypeArgList { | 717 | pub struct TypeArgList { |
710 | pub(crate) syntax: SyntaxNode, | 718 | pub(crate) syntax: SyntaxNode, |
711 | } | 719 | } |
@@ -1190,14 +1198,6 @@ impl UseTreeList { | |||
1190 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 1198 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1191 | } | 1199 | } |
1192 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1193 | pub struct Rename { | ||
1194 | pub(crate) syntax: SyntaxNode, | ||
1195 | } | ||
1196 | impl ast::NameOwner for Rename {} | ||
1197 | impl Rename { | ||
1198 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
1199 | } | ||
1200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1201 | pub struct PathSegment { | 1201 | pub struct PathSegment { |
1202 | pub(crate) syntax: SyntaxNode, | 1202 | pub(crate) syntax: SyntaxNode, |
1203 | } | 1203 | } |
@@ -1272,7 +1272,7 @@ pub enum Item { | |||
1272 | ConstDef(ConstDef), | 1272 | ConstDef(ConstDef), |
1273 | EnumDef(EnumDef), | 1273 | EnumDef(EnumDef), |
1274 | ExternBlock(ExternBlock), | 1274 | ExternBlock(ExternBlock), |
1275 | ExternCrateItem(ExternCrateItem), | 1275 | ExternCrate(ExternCrate), |
1276 | FnDef(FnDef), | 1276 | FnDef(FnDef), |
1277 | ImplDef(ImplDef), | 1277 | ImplDef(ImplDef), |
1278 | MacroCall(MacroCall), | 1278 | MacroCall(MacroCall), |
@@ -1451,8 +1451,8 @@ impl AstNode for ExternBlock { | |||
1451 | } | 1451 | } |
1452 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1452 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1453 | } | 1453 | } |
1454 | impl AstNode for ExternCrateItem { | 1454 | impl AstNode for ExternCrate { |
1455 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } | 1455 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } |
1456 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1456 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1457 | if Self::can_cast(syntax.kind()) { | 1457 | if Self::can_cast(syntax.kind()) { |
1458 | Some(Self { syntax }) | 1458 | Some(Self { syntax }) |
@@ -1605,6 +1605,28 @@ impl AstNode for ItemList { | |||
1605 | } | 1605 | } |
1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1607 | } | 1607 | } |
1608 | impl AstNode for NameRef { | ||
1609 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } | ||
1610 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1611 | if Self::can_cast(syntax.kind()) { | ||
1612 | Some(Self { syntax }) | ||
1613 | } else { | ||
1614 | None | ||
1615 | } | ||
1616 | } | ||
1617 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1618 | } | ||
1619 | impl AstNode for Rename { | ||
1620 | fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } | ||
1621 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1622 | if Self::can_cast(syntax.kind()) { | ||
1623 | Some(Self { syntax }) | ||
1624 | } else { | ||
1625 | None | ||
1626 | } | ||
1627 | } | ||
1628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1629 | } | ||
1608 | impl AstNode for Abi { | 1630 | impl AstNode for Abi { |
1609 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 1631 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } |
1610 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1632 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2111,17 +2133,6 @@ impl AstNode for MethodCallExpr { | |||
2111 | } | 2133 | } |
2112 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2134 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2113 | } | 2135 | } |
2114 | impl AstNode for NameRef { | ||
2115 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } | ||
2116 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2117 | if Self::can_cast(syntax.kind()) { | ||
2118 | Some(Self { syntax }) | ||
2119 | } else { | ||
2120 | None | ||
2121 | } | ||
2122 | } | ||
2123 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2124 | } | ||
2125 | impl AstNode for TypeArgList { | 2136 | impl AstNode for TypeArgList { |
2126 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } | 2137 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } |
2127 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2138 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2683,17 +2694,6 @@ impl AstNode for UseTreeList { | |||
2683 | } | 2694 | } |
2684 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2695 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2685 | } | 2696 | } |
2686 | impl AstNode for Rename { | ||
2687 | fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } | ||
2688 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2689 | if Self::can_cast(syntax.kind()) { | ||
2690 | Some(Self { syntax }) | ||
2691 | } else { | ||
2692 | None | ||
2693 | } | ||
2694 | } | ||
2695 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2696 | } | ||
2697 | impl AstNode for PathSegment { | 2697 | impl AstNode for PathSegment { |
2698 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2698 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
2699 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2699 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2780,8 +2780,8 @@ impl From<EnumDef> for Item { | |||
2780 | impl From<ExternBlock> for Item { | 2780 | impl From<ExternBlock> for Item { |
2781 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } | 2781 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } |
2782 | } | 2782 | } |
2783 | impl From<ExternCrateItem> for Item { | 2783 | impl From<ExternCrate> for Item { |
2784 | fn from(node: ExternCrateItem) -> Item { Item::ExternCrateItem(node) } | 2784 | fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) } |
2785 | } | 2785 | } |
2786 | impl From<FnDef> for Item { | 2786 | impl From<FnDef> for Item { |
2787 | fn from(node: FnDef) -> Item { Item::FnDef(node) } | 2787 | fn from(node: FnDef) -> Item { Item::FnDef(node) } |
@@ -2816,9 +2816,9 @@ impl From<UseItem> for Item { | |||
2816 | impl AstNode for Item { | 2816 | impl AstNode for Item { |
2817 | fn can_cast(kind: SyntaxKind) -> bool { | 2817 | fn can_cast(kind: SyntaxKind) -> bool { |
2818 | match kind { | 2818 | match kind { |
2819 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE_ITEM | FN_DEF | IMPL_DEF | 2819 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL |
2820 | | MACRO_CALL | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | 2820 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF |
2821 | | UNION_DEF | USE_ITEM => true, | 2821 | | USE_ITEM => true, |
2822 | _ => false, | 2822 | _ => false, |
2823 | } | 2823 | } |
2824 | } | 2824 | } |
@@ -2827,7 +2827,7 @@ impl AstNode for Item { | |||
2827 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), | 2827 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), |
2828 | ENUM_DEF => Item::EnumDef(EnumDef { syntax }), | 2828 | ENUM_DEF => Item::EnumDef(EnumDef { syntax }), |
2829 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), | 2829 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), |
2830 | EXTERN_CRATE_ITEM => Item::ExternCrateItem(ExternCrateItem { syntax }), | 2830 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), |
2831 | FN_DEF => Item::FnDef(FnDef { syntax }), | 2831 | FN_DEF => Item::FnDef(FnDef { syntax }), |
2832 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), | 2832 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), |
2833 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), | 2833 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), |
@@ -2847,7 +2847,7 @@ impl AstNode for Item { | |||
2847 | Item::ConstDef(it) => &it.syntax, | 2847 | Item::ConstDef(it) => &it.syntax, |
2848 | Item::EnumDef(it) => &it.syntax, | 2848 | Item::EnumDef(it) => &it.syntax, |
2849 | Item::ExternBlock(it) => &it.syntax, | 2849 | Item::ExternBlock(it) => &it.syntax, |
2850 | Item::ExternCrateItem(it) => &it.syntax, | 2850 | Item::ExternCrate(it) => &it.syntax, |
2851 | Item::FnDef(it) => &it.syntax, | 2851 | Item::FnDef(it) => &it.syntax, |
2852 | Item::ImplDef(it) => &it.syntax, | 2852 | Item::ImplDef(it) => &it.syntax, |
2853 | Item::MacroCall(it) => &it.syntax, | 2853 | Item::MacroCall(it) => &it.syntax, |
@@ -3480,7 +3480,7 @@ impl std::fmt::Display for ExternBlock { | |||
3480 | std::fmt::Display::fmt(self.syntax(), f) | 3480 | std::fmt::Display::fmt(self.syntax(), f) |
3481 | } | 3481 | } |
3482 | } | 3482 | } |
3483 | impl std::fmt::Display for ExternCrateItem { | 3483 | impl std::fmt::Display for ExternCrate { |
3484 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3484 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3485 | std::fmt::Display::fmt(self.syntax(), f) | 3485 | std::fmt::Display::fmt(self.syntax(), f) |
3486 | } | 3486 | } |
@@ -3550,6 +3550,16 @@ impl std::fmt::Display for ItemList { | |||
3550 | std::fmt::Display::fmt(self.syntax(), f) | 3550 | std::fmt::Display::fmt(self.syntax(), f) |
3551 | } | 3551 | } |
3552 | } | 3552 | } |
3553 | impl std::fmt::Display for NameRef { | ||
3554 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3555 | std::fmt::Display::fmt(self.syntax(), f) | ||
3556 | } | ||
3557 | } | ||
3558 | impl std::fmt::Display for Rename { | ||
3559 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3560 | std::fmt::Display::fmt(self.syntax(), f) | ||
3561 | } | ||
3562 | } | ||
3553 | impl std::fmt::Display for Abi { | 3563 | impl std::fmt::Display for Abi { |
3554 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3564 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3555 | std::fmt::Display::fmt(self.syntax(), f) | 3565 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3780,11 +3790,6 @@ impl std::fmt::Display for MethodCallExpr { | |||
3780 | std::fmt::Display::fmt(self.syntax(), f) | 3790 | std::fmt::Display::fmt(self.syntax(), f) |
3781 | } | 3791 | } |
3782 | } | 3792 | } |
3783 | impl std::fmt::Display for NameRef { | ||
3784 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3785 | std::fmt::Display::fmt(self.syntax(), f) | ||
3786 | } | ||
3787 | } | ||
3788 | impl std::fmt::Display for TypeArgList { | 3793 | impl std::fmt::Display for TypeArgList { |
3789 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3794 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3790 | std::fmt::Display::fmt(self.syntax(), f) | 3795 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4040,11 +4045,6 @@ impl std::fmt::Display for UseTreeList { | |||
4040 | std::fmt::Display::fmt(self.syntax(), f) | 4045 | std::fmt::Display::fmt(self.syntax(), f) |
4041 | } | 4046 | } |
4042 | } | 4047 | } |
4043 | impl std::fmt::Display for Rename { | ||
4044 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4045 | std::fmt::Display::fmt(self.syntax(), f) | ||
4046 | } | ||
4047 | } | ||
4048 | impl std::fmt::Display for PathSegment { | 4048 | impl std::fmt::Display for PathSegment { |
4049 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4049 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4050 | std::fmt::Display::fmt(self.syntax(), f) | 4050 | std::fmt::Display::fmt(self.syntax(), f) |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index bcd92c3bc..083727c5c 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -98,7 +98,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
98 | "ENUM_DEF", | 98 | "ENUM_DEF", |
99 | "FN_DEF", | 99 | "FN_DEF", |
100 | "RET_TYPE", | 100 | "RET_TYPE", |
101 | "EXTERN_CRATE_ITEM", | 101 | "EXTERN_CRATE", |
102 | "MODULE", | 102 | "MODULE", |
103 | "USE_ITEM", | 103 | "USE_ITEM", |
104 | "STATIC_DEF", | 104 | "STATIC_DEF", |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 76c070402..e6e7c7518 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -7,7 +7,7 @@ Item = | |||
7 | ConstDef | 7 | ConstDef |
8 | | EnumDef | 8 | | EnumDef |
9 | | ExternBlock | 9 | | ExternBlock |
10 | | ExternCrateItem | 10 | | ExternCrate |
11 | | FnDef | 11 | | FnDef |
12 | | ImplDef | 12 | | ImplDef |
13 | | MacroCall | 13 | | MacroCall |
@@ -26,6 +26,9 @@ Module = | |||
26 | ItemList = | 26 | ItemList = |
27 | '{' Attr* Item* '}' | 27 | '{' Attr* Item* '}' |
28 | 28 | ||
29 | ExternCrate = | ||
30 | Attr* Visibility? 'extern' 'crate' (NameRef | 'self') Rename? ';' | ||
31 | |||
29 | FnDef = | 32 | FnDef = |
30 | Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? | 33 | Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? |
31 | ParamList RetType? | 34 | ParamList RetType? |
@@ -404,9 +407,6 @@ UseTreeList = | |||
404 | Rename = | 407 | Rename = |
405 | 'as' Name | 408 | 'as' Name |
406 | 409 | ||
407 | ExternCrateItem = | ||
408 | Attr* Visibility? 'extern' 'crate' (NameRef | 'self') Rename? ';' | ||
409 | |||
410 | Path = | 410 | Path = |
411 | (qualifier:Path '::')? segment:PathSegment | 411 | (qualifier:Path '::')? segment:PathSegment |
412 | 412 | ||