diff options
-rw-r--r-- | crates/ra_assists/src/handlers/change_return_type_to_result.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 3 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 130 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 13 |
4 files changed, 68 insertions, 79 deletions
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs index 4b73c41da..b83c94404 100644 --- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs +++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs | |||
@@ -241,7 +241,6 @@ fn get_tail_expr_from_block(expr: &Expr) -> Option<Vec<NodeType>> { | |||
241 | Expr::ArrayExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 241 | Expr::ArrayExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
242 | Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 242 | Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
243 | Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 243 | Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
244 | Expr::Label(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | ||
245 | Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 244 | Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
246 | Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 245 | Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
247 | Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 246 | Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 99d723402..0cacc63ef 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -569,9 +569,6 @@ impl ExprCollector<'_> { | |||
569 | } | 569 | } |
570 | } | 570 | } |
571 | } | 571 | } |
572 | |||
573 | // FIXME implement HIR for these: | ||
574 | ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
575 | } | 572 | } |
576 | } | 573 | } |
577 | 574 | ||
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 158544fa2..e049548c9 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -624,6 +624,19 @@ impl CastExpr { | |||
624 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 624 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
625 | } | 625 | } |
626 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 626 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
627 | pub struct ClosureExpr { | ||
628 | pub(crate) syntax: SyntaxNode, | ||
629 | } | ||
630 | impl ast::AttrsOwner for ClosureExpr {} | ||
631 | impl ClosureExpr { | ||
632 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
633 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
634 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | ||
635 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
636 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
637 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
638 | } | ||
639 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
627 | pub struct ContinueExpr { | 640 | pub struct ContinueExpr { |
628 | pub(crate) syntax: SyntaxNode, | 641 | pub(crate) syntax: SyntaxNode, |
629 | } | 642 | } |
@@ -690,28 +703,6 @@ impl IndexExpr { | |||
690 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 703 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
691 | } | 704 | } |
692 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 705 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
693 | pub struct Label { | ||
694 | pub(crate) syntax: SyntaxNode, | ||
695 | } | ||
696 | impl Label { | ||
697 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
698 | support::token(&self.syntax, T![lifetime]) | ||
699 | } | ||
700 | } | ||
701 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
702 | pub struct ClosureExpr { | ||
703 | pub(crate) syntax: SyntaxNode, | ||
704 | } | ||
705 | impl ast::AttrsOwner for ClosureExpr {} | ||
706 | impl ClosureExpr { | ||
707 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
708 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
709 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | ||
710 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
711 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
712 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
713 | } | ||
714 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
715 | pub struct LoopExpr { | 706 | pub struct LoopExpr { |
716 | pub(crate) syntax: SyntaxNode, | 707 | pub(crate) syntax: SyntaxNode, |
717 | } | 708 | } |
@@ -835,6 +826,15 @@ impl WhileExpr { | |||
835 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 826 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
836 | } | 827 | } |
837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
829 | pub struct Label { | ||
830 | pub(crate) syntax: SyntaxNode, | ||
831 | } | ||
832 | impl Label { | ||
833 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
834 | support::token(&self.syntax, T![lifetime]) | ||
835 | } | ||
836 | } | ||
837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
838 | pub struct RecordExprFieldList { | 838 | pub struct RecordExprFieldList { |
839 | pub(crate) syntax: SyntaxNode, | 839 | pub(crate) syntax: SyntaxNode, |
840 | } | 840 | } |
@@ -1337,14 +1337,13 @@ pub enum Expr { | |||
1337 | BreakExpr(BreakExpr), | 1337 | BreakExpr(BreakExpr), |
1338 | CallExpr(CallExpr), | 1338 | CallExpr(CallExpr), |
1339 | CastExpr(CastExpr), | 1339 | CastExpr(CastExpr), |
1340 | ClosureExpr(ClosureExpr), | ||
1340 | ContinueExpr(ContinueExpr), | 1341 | ContinueExpr(ContinueExpr), |
1341 | EffectExpr(EffectExpr), | 1342 | EffectExpr(EffectExpr), |
1342 | FieldExpr(FieldExpr), | 1343 | FieldExpr(FieldExpr), |
1343 | ForExpr(ForExpr), | 1344 | ForExpr(ForExpr), |
1344 | IfExpr(IfExpr), | 1345 | IfExpr(IfExpr), |
1345 | IndexExpr(IndexExpr), | 1346 | IndexExpr(IndexExpr), |
1346 | Label(Label), | ||
1347 | ClosureExpr(ClosureExpr), | ||
1348 | Literal(Literal), | 1347 | Literal(Literal), |
1349 | LoopExpr(LoopExpr), | 1348 | LoopExpr(LoopExpr), |
1350 | MacroCall(MacroCall), | 1349 | MacroCall(MacroCall), |
@@ -2017,6 +2016,17 @@ impl AstNode for CastExpr { | |||
2017 | } | 2016 | } |
2018 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2017 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2019 | } | 2018 | } |
2019 | impl AstNode for ClosureExpr { | ||
2020 | fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } | ||
2021 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2022 | if Self::can_cast(syntax.kind()) { | ||
2023 | Some(Self { syntax }) | ||
2024 | } else { | ||
2025 | None | ||
2026 | } | ||
2027 | } | ||
2028 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2029 | } | ||
2020 | impl AstNode for ContinueExpr { | 2030 | impl AstNode for ContinueExpr { |
2021 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } | 2031 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } |
2022 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2032 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2083,28 +2093,6 @@ impl AstNode for IndexExpr { | |||
2083 | } | 2093 | } |
2084 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2094 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2085 | } | 2095 | } |
2086 | impl AstNode for Label { | ||
2087 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } | ||
2088 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2089 | if Self::can_cast(syntax.kind()) { | ||
2090 | Some(Self { syntax }) | ||
2091 | } else { | ||
2092 | None | ||
2093 | } | ||
2094 | } | ||
2095 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2096 | } | ||
2097 | impl AstNode for ClosureExpr { | ||
2098 | fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } | ||
2099 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2100 | if Self::can_cast(syntax.kind()) { | ||
2101 | Some(Self { syntax }) | ||
2102 | } else { | ||
2103 | None | ||
2104 | } | ||
2105 | } | ||
2106 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2107 | } | ||
2108 | impl AstNode for LoopExpr { | 2096 | impl AstNode for LoopExpr { |
2109 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } | 2097 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } |
2110 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2098 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2248,6 +2236,17 @@ impl AstNode for WhileExpr { | |||
2248 | } | 2236 | } |
2249 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2237 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2250 | } | 2238 | } |
2239 | impl AstNode for Label { | ||
2240 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } | ||
2241 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2242 | if Self::can_cast(syntax.kind()) { | ||
2243 | Some(Self { syntax }) | ||
2244 | } else { | ||
2245 | None | ||
2246 | } | ||
2247 | } | ||
2248 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2249 | } | ||
2251 | impl AstNode for RecordExprFieldList { | 2250 | impl AstNode for RecordExprFieldList { |
2252 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } | 2251 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } |
2253 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2252 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3086,6 +3085,9 @@ impl From<CallExpr> for Expr { | |||
3086 | impl From<CastExpr> for Expr { | 3085 | impl From<CastExpr> for Expr { |
3087 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | 3086 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } |
3088 | } | 3087 | } |
3088 | impl From<ClosureExpr> for Expr { | ||
3089 | fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) } | ||
3090 | } | ||
3089 | impl From<ContinueExpr> for Expr { | 3091 | impl From<ContinueExpr> for Expr { |
3090 | fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } | 3092 | fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } |
3091 | } | 3093 | } |
@@ -3104,12 +3106,6 @@ impl From<IfExpr> for Expr { | |||
3104 | impl From<IndexExpr> for Expr { | 3106 | impl From<IndexExpr> for Expr { |
3105 | fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } | 3107 | fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } |
3106 | } | 3108 | } |
3107 | impl From<Label> for Expr { | ||
3108 | fn from(node: Label) -> Expr { Expr::Label(node) } | ||
3109 | } | ||
3110 | impl From<ClosureExpr> for Expr { | ||
3111 | fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) } | ||
3112 | } | ||
3113 | impl From<Literal> for Expr { | 3109 | impl From<Literal> for Expr { |
3114 | fn from(node: Literal) -> Expr { Expr::Literal(node) } | 3110 | fn from(node: Literal) -> Expr { Expr::Literal(node) } |
3115 | } | 3111 | } |
@@ -3159,8 +3155,8 @@ impl AstNode for Expr { | |||
3159 | fn can_cast(kind: SyntaxKind) -> bool { | 3155 | fn can_cast(kind: SyntaxKind) -> bool { |
3160 | match kind { | 3156 | match kind { |
3161 | ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR | 3157 | ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR |
3162 | | CAST_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | IF_EXPR | 3158 | | CAST_EXPR | CLOSURE_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR |
3163 | | INDEX_EXPR | LABEL | CLOSURE_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR | 3159 | | IF_EXPR | INDEX_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR |
3164 | | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR | 3160 | | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR |
3165 | | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true, | 3161 | | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true, |
3166 | _ => false, | 3162 | _ => false, |
@@ -3176,14 +3172,13 @@ impl AstNode for Expr { | |||
3176 | BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), | 3172 | BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), |
3177 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), | 3173 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), |
3178 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | 3174 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), |
3175 | CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }), | ||
3179 | CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }), | 3176 | CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }), |
3180 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | 3177 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), |
3181 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | 3178 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), |
3182 | FOR_EXPR => Expr::ForExpr(ForExpr { syntax }), | 3179 | FOR_EXPR => Expr::ForExpr(ForExpr { syntax }), |
3183 | IF_EXPR => Expr::IfExpr(IfExpr { syntax }), | 3180 | IF_EXPR => Expr::IfExpr(IfExpr { syntax }), |
3184 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), | 3181 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), |
3185 | LABEL => Expr::Label(Label { syntax }), | ||
3186 | CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }), | ||
3187 | LITERAL => Expr::Literal(Literal { syntax }), | 3182 | LITERAL => Expr::Literal(Literal { syntax }), |
3188 | LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), | 3183 | LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), |
3189 | MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), | 3184 | MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), |
@@ -3213,14 +3208,13 @@ impl AstNode for Expr { | |||
3213 | Expr::BreakExpr(it) => &it.syntax, | 3208 | Expr::BreakExpr(it) => &it.syntax, |
3214 | Expr::CallExpr(it) => &it.syntax, | 3209 | Expr::CallExpr(it) => &it.syntax, |
3215 | Expr::CastExpr(it) => &it.syntax, | 3210 | Expr::CastExpr(it) => &it.syntax, |
3211 | Expr::ClosureExpr(it) => &it.syntax, | ||
3216 | Expr::ContinueExpr(it) => &it.syntax, | 3212 | Expr::ContinueExpr(it) => &it.syntax, |
3217 | Expr::EffectExpr(it) => &it.syntax, | 3213 | Expr::EffectExpr(it) => &it.syntax, |
3218 | Expr::FieldExpr(it) => &it.syntax, | 3214 | Expr::FieldExpr(it) => &it.syntax, |
3219 | Expr::ForExpr(it) => &it.syntax, | 3215 | Expr::ForExpr(it) => &it.syntax, |
3220 | Expr::IfExpr(it) => &it.syntax, | 3216 | Expr::IfExpr(it) => &it.syntax, |
3221 | Expr::IndexExpr(it) => &it.syntax, | 3217 | Expr::IndexExpr(it) => &it.syntax, |
3222 | Expr::Label(it) => &it.syntax, | ||
3223 | Expr::ClosureExpr(it) => &it.syntax, | ||
3224 | Expr::Literal(it) => &it.syntax, | 3218 | Expr::Literal(it) => &it.syntax, |
3225 | Expr::LoopExpr(it) => &it.syntax, | 3219 | Expr::LoopExpr(it) => &it.syntax, |
3226 | Expr::MacroCall(it) => &it.syntax, | 3220 | Expr::MacroCall(it) => &it.syntax, |
@@ -3715,6 +3709,11 @@ impl std::fmt::Display for CastExpr { | |||
3715 | std::fmt::Display::fmt(self.syntax(), f) | 3709 | std::fmt::Display::fmt(self.syntax(), f) |
3716 | } | 3710 | } |
3717 | } | 3711 | } |
3712 | impl std::fmt::Display for ClosureExpr { | ||
3713 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3714 | std::fmt::Display::fmt(self.syntax(), f) | ||
3715 | } | ||
3716 | } | ||
3718 | impl std::fmt::Display for ContinueExpr { | 3717 | impl std::fmt::Display for ContinueExpr { |
3719 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3718 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3720 | std::fmt::Display::fmt(self.syntax(), f) | 3719 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3745,16 +3744,6 @@ impl std::fmt::Display for IndexExpr { | |||
3745 | std::fmt::Display::fmt(self.syntax(), f) | 3744 | std::fmt::Display::fmt(self.syntax(), f) |
3746 | } | 3745 | } |
3747 | } | 3746 | } |
3748 | impl std::fmt::Display for Label { | ||
3749 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3750 | std::fmt::Display::fmt(self.syntax(), f) | ||
3751 | } | ||
3752 | } | ||
3753 | impl std::fmt::Display for ClosureExpr { | ||
3754 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3755 | std::fmt::Display::fmt(self.syntax(), f) | ||
3756 | } | ||
3757 | } | ||
3758 | impl std::fmt::Display for LoopExpr { | 3747 | impl std::fmt::Display for LoopExpr { |
3759 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3748 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3760 | std::fmt::Display::fmt(self.syntax(), f) | 3749 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3820,6 +3809,11 @@ impl std::fmt::Display for WhileExpr { | |||
3820 | std::fmt::Display::fmt(self.syntax(), f) | 3809 | std::fmt::Display::fmt(self.syntax(), f) |
3821 | } | 3810 | } |
3822 | } | 3811 | } |
3812 | impl std::fmt::Display for Label { | ||
3813 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3814 | std::fmt::Display::fmt(self.syntax(), f) | ||
3815 | } | ||
3816 | } | ||
3823 | impl std::fmt::Display for RecordExprFieldList { | 3817 | impl std::fmt::Display for RecordExprFieldList { |
3824 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3818 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3825 | std::fmt::Display::fmt(self.syntax(), f) | 3819 | std::fmt::Display::fmt(self.syntax(), f) |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index aef07cb1e..8edabc3b9 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -215,14 +215,13 @@ Expr = | |||
215 | | BreakExpr | 215 | | BreakExpr |
216 | | CallExpr | 216 | | CallExpr |
217 | | CastExpr | 217 | | CastExpr |
218 | | ClosureExpr | ||
218 | | ContinueExpr | 219 | | ContinueExpr |
219 | | EffectExpr | 220 | | EffectExpr |
220 | | FieldExpr | 221 | | FieldExpr |
221 | | ForExpr | 222 | | ForExpr |
222 | | IfExpr | 223 | | IfExpr |
223 | | IndexExpr | 224 | | IndexExpr |
224 | | Label | ||
225 | | ClosureExpr | ||
226 | | Literal | 225 | | Literal |
227 | | LoopExpr | 226 | | LoopExpr |
228 | | MacroCall | 227 | | MacroCall |
@@ -340,7 +339,7 @@ ForExpr = | |||
340 | 339 | ||
341 | WhileExpr = | 340 | WhileExpr = |
342 | Attr* Label? 'while' Condition | 341 | Attr* Label? 'while' Condition |
343 | loop_body:BlockExpr? | 342 | loop_body:BlockExpr |
344 | 343 | ||
345 | Label = | 344 | Label = |
346 | 'lifetime' | 345 | 'lifetime' |
@@ -418,13 +417,13 @@ SliceType = | |||
418 | '[' Type ']' | 417 | '[' Type ']' |
419 | 418 | ||
420 | InferType = | 419 | InferType = |
421 | '_' | 420 | '_' |
422 | 421 | ||
423 | FnPointerType = | 422 | FnPointerType = |
424 | 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? | 423 | 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? |
425 | 424 | ||
426 | ForType = | 425 | ForType = |
427 | 'for' GenericParamList Type | 426 | 'for' GenericParamList Type |
428 | 427 | ||
429 | ImplTraitType = | 428 | ImplTraitType = |
430 | 'impl' TypeBoundList | 429 | 'impl' TypeBoundList |
@@ -433,7 +432,7 @@ DynTraitType = | |||
433 | 'dyn' TypeBoundList | 432 | 'dyn' TypeBoundList |
434 | 433 | ||
435 | TypeBoundList = | 434 | TypeBoundList = |
436 | bounds:(TypeBound ('+' TypeBound)* '+'?) | 435 | bounds:(TypeBound ('+' TypeBound)* '+'?) |
437 | 436 | ||
438 | TypeBound = | 437 | TypeBound = |
439 | 'lifetime' | 438 | 'lifetime' |