Skip to content

Commit

Permalink
"Finalize" Types grammar
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
matklad committed Jul 31, 2020
1 parent a6e45c6 commit a6527ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion crates/ra_hir_def/src/type_ref.rs
@@ -1,6 +1,5 @@
//! HIR for references to types. Paths in these are not yet resolved. They can
//! be directly created from an ast::TypeRef, without further queries.

use ra_syntax::ast::{self};

use crate::{body::LowerCtx, path::Path};
Expand Down
4 changes: 3 additions & 1 deletion crates/ra_syntax/src/ast/generated/nodes.rs
Expand Up @@ -605,8 +605,10 @@ pub struct FnPointerType {
pub(crate) syntax: SyntaxNode,
}
impl FnPointerType {
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/codegen/rust.ungram
Expand Up @@ -231,7 +231,7 @@ InferType =
'_'

FnPointerType =
Abi 'unsafe'? 'fn' ParamList RetType?
'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType?

ForType =
'for' GenericParamList Type
Expand Down

0 comments on commit a6527ed

Please sign in to comment.