Skip to content

Commit 847a50e

Browse files
bors[bot]matklad
andauthored
Merge #5620
5620: Finalize Types grammar r=matklad a=matklad 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... bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents eccb5d5 + a6527ed commit 847a50e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

crates/ra_hir_def/src/type_ref.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! HIR for references to types. Paths in these are not yet resolved. They can
22
//! be directly created from an ast::TypeRef, without further queries.
3-
43
use ra_syntax::ast::{self};
54

65
use crate::{body::LowerCtx, path::Path};

crates/ra_syntax/src/ast/generated/nodes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,10 @@ pub struct FnPointerType {
605605
pub(crate) syntax: SyntaxNode,
606606
}
607607
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]) }
609610
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
611+
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
610612
pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
611613
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
612614
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }

xtask/src/codegen/rust.ungram

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ InferType =
231231
'_'
232232

233233
FnPointerType =
234-
Abi 'unsafe'? 'fn' ParamList RetType?
234+
'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType?
235235

236236
ForType =
237237
'for' GenericParamList Type

0 commit comments

Comments
 (0)