diff options
Diffstat (limited to 'crates/ra_syntax')
3 files changed, 137 insertions, 44 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index cf6067e57..255402fbc 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -1235,6 +1235,8 @@ impl CastExpr { | |||
1235 | /// ``` | 1235 | /// ``` |
1236 | /// ❰ &foo ❱; | 1236 | /// ❰ &foo ❱; |
1237 | /// ❰ &mut bar ❱; | 1237 | /// ❰ &mut bar ❱; |
1238 | /// ❰ &raw const bar ❱; | ||
1239 | /// ❰ &raw mut bar ❱; | ||
1238 | /// ``` | 1240 | /// ``` |
1239 | /// | 1241 | /// |
1240 | /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#borrow-operators) | 1242 | /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#borrow-operators) |
@@ -1247,6 +1249,7 @@ impl RefExpr { | |||
1247 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 1249 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1248 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } | 1250 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } |
1249 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 1251 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1252 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1250 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1253 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1251 | } | 1254 | } |
1252 | /// Prefix operator call. This is either `!` or `*` or `-`. | 1255 | /// Prefix operator call. This is either `!` or `*` or `-`. |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast index 7fe96e17d..58bdf7e34 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@0..52 | 1 | [email protected]00 |
2 | FN_DEF@0..51 | 2 | [email protected]99 |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -8,47 +8,131 @@ [email protected] | |||
8 | [email protected] "(" | 8 | [email protected] "(" |
9 | [email protected] ")" | 9 | [email protected] ")" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | BLOCK_EXPR@9..51 | 11 | [email protected]99 |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | [email protected] | 14 | [email protected] "// reference operator" |
15 | [email protected] "let" | 15 | [email protected] "\n " |
16 | [email protected] " " | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] "let" |
18 | [email protected] "_" | 18 | [email protected] " " |
19 | [email protected] " " | 19 | [email protected] |
20 | [email protected] "=" | 20 | [email protected] "_" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] "=" |
23 | [email protected] "&" | 23 | [email protected] " " |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "1" | 25 | [email protected] "&" |
26 | [email protected] ";" | 26 | [email protected] |
27 | [email protected] "\n " | 27 | [email protected] "1" |
28 | [email protected] | 28 | [email protected] ";" |
29 | [email protected] "let" | 29 | [email protected] "\n " |
30 | [email protected] " " | 30 | [email protected] |
31 | [email protected] | 31 | [email protected] "let" |
32 | [email protected] "_" | 32 | [email protected] " " |
33 | [email protected] " " | 33 | [email protected] |
34 | [email protected] "=" | 34 | [email protected] "_" |
35 | [email protected] " " | 35 | [email protected] " " |
36 | [email protected] | 36 | [email protected] "=" |
37 | [email protected] "&" | 37 | [email protected] " " |
38 | [email protected] "mut" | 38 | [email protected] |
39 | [email protected] " " | 39 | [email protected] "&" |
40 | [email protected] | 40 | [email protected] "mut" |
41 | [email protected] "&" | 41 | [email protected] " " |
42 | [email protected] | 42 | [email protected] |
43 | [email protected] | 43 | [email protected] "&" |
44 | [email protected] | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] |
46 | [email protected] | 46 | [email protected] |
47 | [email protected] "f" | 47 | [email protected] |
48 | [email protected] | 48 | [email protected] |
49 | [email protected] "(" | 49 | [email protected] "f" |
50 | [email protected] ")" | 50 | [email protected] |
51 | [email protected] ";" | 51 | [email protected] "(" |
52 | [email protected] "\n" | 52 | [email protected] ")" |
53 | [email protected] "}" | 53 | [email protected] ";" |
54 | [email protected] "\n" | 54 | [email protected] "\n " |
55 | [email protected] | ||
56 | [email protected] "let" | ||
57 | [email protected] " " | ||
58 | [email protected] | ||
59 | [email protected] "_" | ||
60 | [email protected] " " | ||
61 | [email protected] "=" | ||
62 | [email protected] " " | ||
63 | [email protected] | ||
64 | [email protected] "&" | ||
65 | [email protected] | ||
66 | [email protected] | ||
67 | [email protected] | ||
68 | [email protected] | ||
69 | [email protected] "raw" | ||
70 | [email protected] ";" | ||
71 | [email protected] "\n " | ||
72 | [email protected] | ||
73 | [email protected] "let" | ||
74 | [email protected] " " | ||
75 | [email protected] | ||
76 | [email protected] "_" | ||
77 | [email protected] " " | ||
78 | [email protected] "=" | ||
79 | [email protected] " " | ||
80 | [email protected] | ||
81 | [email protected] "&" | ||
82 | [email protected] | ||
83 | [email protected] | ||
84 | [email protected] | ||
85 | [email protected] | ||
86 | [email protected] | ||
87 | [email protected] "raw" | ||
88 | [email protected] "." | ||
89 | [email protected] | ||
90 | [email protected] "0" | ||
91 | [email protected] ";" | ||
92 | [email protected] "\n " | ||
93 | [email protected] "// raw reference oper ..." | ||
94 | [email protected] "\n " | ||
95 | [email protected] | ||
96 | [email protected] "let" | ||
97 | [email protected] " " | ||
98 | [email protected] | ||
99 | [email protected] "_" | ||
100 | [email protected] " " | ||
101 | [email protected] "=" | ||
102 | [email protected] " " | ||
103 | [email protected] | ||
104 | [email protected] "&" | ||
105 | [email protected] "raw" | ||
106 | [email protected] " " | ||
107 | [email protected] "mut" | ||
108 | [email protected] " " | ||
109 | [email protected] | ||
110 | [email protected] | ||
111 | [email protected] | ||
112 | [email protected] | ||
113 | [email protected] "foo" | ||
114 | [email protected] ";" | ||
115 | [email protected] "\n " | ||
116 | [email protected] | ||
117 | [email protected] "let" | ||
118 | [email protected] " " | ||
119 | [email protected] | ||
120 | [email protected] "_" | ||
121 | [email protected] " " | ||
122 | [email protected] "=" | ||
123 | [email protected] " " | ||
124 | [email protected] | ||
125 | [email protected] "&" | ||
126 | [email protected] "raw" | ||
127 | [email protected] " " | ||
128 | [email protected] "const" | ||
129 | [email protected] " " | ||
130 | [email protected] | ||
131 | [email protected] | ||
132 | [email protected] | ||
133 | [email protected] | ||
134 | [email protected] "foo" | ||
135 | [email protected] ";" | ||
136 | [email protected] "\n" | ||
137 | [email protected] "}" | ||
138 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs index 2dac6be95..c5262f446 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs | |||
@@ -1,4 +1,10 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | // reference operator | ||
2 | let _ = &1; | 3 | let _ = &1; |
3 | let _ = &mut &f(); | 4 | let _ = &mut &f(); |
5 | let _ = &raw; | ||
6 | let _ = &raw.0; | ||
7 | // raw reference operator | ||
8 | let _ = &raw mut foo; | ||
9 | let _ = &raw const foo; | ||
4 | } | 10 | } |