diff options
author | Aleksey Kladov <[email protected]> | 2020-07-31 13:40:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-31 13:40:28 +0100 |
commit | a6527ed92cb7a1156b8a118f5790d8c5fd69ab41 (patch) | |
tree | 807d7e40f6617b016eb88d47f764a738470a54f6 | |
parent | a6e45c6c69bf258118940941c12d057deb79e60c (diff) |
"Finalize" Types grammar
Note that `for` type is rust-analyzer's own invention.
Both the reference and syn allow `for` only for fnptr types, and we
allow them everywhere. This needs to be checked with respect to type
bounds grammar...
-rw-r--r-- | crates/ra_hir_def/src/type_ref.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 4 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs index 524c033b8..fe6619d9f 100644 --- a/crates/ra_hir_def/src/type_ref.rs +++ b/crates/ra_hir_def/src/type_ref.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | //! HIR for references to types. Paths in these are not yet resolved. They can | 1 | //! HIR for references to types. Paths in these are not yet resolved. They can |
2 | //! be directly created from an ast::TypeRef, without further queries. | 2 | //! be directly created from an ast::TypeRef, without further queries. |
3 | |||
4 | use ra_syntax::ast::{self}; | 3 | use ra_syntax::ast::{self}; |
5 | 4 | ||
6 | use crate::{body::LowerCtx, path::Path}; | 5 | use crate::{body::LowerCtx, path::Path}; |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 465cb3202..afa37f227 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -605,8 +605,10 @@ pub struct FnPointerType { | |||
605 | pub(crate) syntax: SyntaxNode, | 605 | pub(crate) syntax: SyntaxNode, |
606 | } | 606 | } |
607 | impl FnPointerType { | 607 | impl FnPointerType { |
608 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 608 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
609 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
609 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 610 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
611 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
610 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | 612 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
611 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 613 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
612 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 614 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 5dee85c2d..4015e3890 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -231,7 +231,7 @@ InferType = | |||
231 | '_' | 231 | '_' |
232 | 232 | ||
233 | FnPointerType = | 233 | FnPointerType = |
234 | Abi 'unsafe'? 'fn' ParamList RetType? | 234 | 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? |
235 | 235 | ||
236 | ForType = | 236 | ForType = |
237 | 'for' GenericParamList Type | 237 | 'for' GenericParamList Type |