aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt41
3 files changed, 37 insertions, 8 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index 06c92645e..4163a2cf5 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -169,6 +169,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
169 // let d: i32 = 92; 169 // let d: i32 = 92;
170 // let e: !; 170 // let e: !;
171 // let _: ! = {}; 171 // let _: ! = {};
172 // let f = #[attr]||{};
172 // } 173 // }
173 fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { 174 fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) {
174 assert!(p.at(T![let])); 175 assert!(p.at(T![let]));
@@ -178,7 +179,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
178 types::ascription(p); 179 types::ascription(p);
179 } 180 }
180 if p.eat(T![=]) { 181 if p.eat(T![=]) {
181 expressions::expr(p); 182 expressions::expr_with_attrs(p);
182 } 183 }
183 184
184 match with_semi { 185 match with_semi {
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs
index 86803fe08..fa8ee49a2 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs
@@ -5,4 +5,5 @@ fn foo() {
5 let d: i32 = 92; 5 let d: i32 = 92;
6 let e: !; 6 let e: !;
7 let _: ! = {}; 7 let _: ! = {};
8 let f = #[attr]||{};
8} 9}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt
index 97166cfd5..17739dfbd 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 110) 1SOURCE_FILE@[0; 135)
2 FN_DEF@[0; 109) 2 FN_DEF@[0; 134)
3 FN_KW@[0; 2) "fn" 3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " " 4 WHITESPACE@[2; 3) " "
5 NAME@[3; 6) 5 NAME@[3; 6)
@@ -8,8 +8,8 @@ SOURCE_FILE@[0; 110)
8 L_PAREN@[6; 7) "(" 8 L_PAREN@[6; 7) "("
9 R_PAREN@[7; 8) ")" 9 R_PAREN@[7; 8) ")"
10 WHITESPACE@[8; 9) " " 10 WHITESPACE@[8; 9) " "
11 BLOCK_EXPR@[9; 109) 11 BLOCK_EXPR@[9; 134)
12 BLOCK@[9; 109) 12 BLOCK@[9; 134)
13 L_CURLY@[9; 10) "{" 13 L_CURLY@[9; 10) "{"
14 WHITESPACE@[10; 15) "\n " 14 WHITESPACE@[10; 15) "\n "
15 LET_STMT@[15; 21) 15 LET_STMT@[15; 21)
@@ -97,6 +97,33 @@ SOURCE_FILE@[0; 110)
97 L_CURLY@[104; 105) "{" 97 L_CURLY@[104; 105) "{"
98 R_CURLY@[105; 106) "}" 98 R_CURLY@[105; 106) "}"
99 SEMI@[106; 107) ";" 99 SEMI@[106; 107) ";"
100 WHITESPACE@[107; 108) "\n" 100 WHITESPACE@[107; 112) "\n "
101 R_CURLY@[108; 109) "}" 101 LET_STMT@[112; 132)
102 WHITESPACE@[109; 110) "\n" 102 LET_KW@[112; 115) "let"
103 WHITESPACE@[115; 116) " "
104 BIND_PAT@[116; 117)
105 NAME@[116; 117)
106 IDENT@[116; 117) "f"
107 WHITESPACE@[117; 118) " "
108 EQ@[118; 119) "="
109 WHITESPACE@[119; 120) " "
110 LAMBDA_EXPR@[120; 131)
111 ATTR@[120; 127)
112 POUND@[120; 121) "#"
113 L_BRACK@[121; 122) "["
114 PATH@[122; 126)
115 PATH_SEGMENT@[122; 126)
116 NAME_REF@[122; 126)
117 IDENT@[122; 126) "attr"
118 R_BRACK@[126; 127) "]"
119 PARAM_LIST@[127; 129)
120 PIPE@[127; 128) "|"
121 PIPE@[128; 129) "|"
122 BLOCK_EXPR@[129; 131)
123 BLOCK@[129; 131)
124 L_CURLY@[129; 130) "{"
125 R_CURLY@[130; 131) "}"
126 SEMI@[131; 132) ";"
127 WHITESPACE@[132; 133) "\n"
128 R_CURLY@[133; 134) "}"
129 WHITESPACE@[134; 135) "\n"