diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-11 18:33:20 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-11 18:33:20 +0100 |
commit | 36353bb1827dbd2efcde2d18c8598c4cc5e2e296 (patch) | |
tree | 5b08ffc573918a2210abbb5b06ec523770cbab1b /crates/ra_syntax/test_data/parser/inline | |
parent | bd61ad756cc0a7bfeaa5dae81ac5ab50a2e71697 (diff) | |
parent | 8622e4cc1b79f5d23b8a2c6610d749f5b987ea7e (diff) |
Merge #4833
4833: Separating parsing of `for` in predicates and types r=matklad a=matthewjasper
We now correctly accept `for<'a> (&'a F): Fn(&'a str)` in a where clause and correctly reject `for<'a> &'a u32` as a type.
Co-authored-by: Matthew Jasper <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
4 files changed, 143 insertions, 273 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast index 9dc473e43..cd0892451 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast | |||
@@ -1,61 +1,60 @@ | |||
1 | [email protected]9 | 1 | SOURCE_FILE@0..54 |
2 | FN_DEF@0..48 | 2 | FN_DEF@0..53 |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "test" | 6 | [email protected] "for_trait" |
7 | [email protected] | 7 | [email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "F" | 11 | [email protected] "F" |
12 | [email protected] ">" | 12 | [email protected] ">" |
13 | [email protected] | 13 | [email protected] |
14 | [email protected] "(" | 14 | [email protected] "(" |
15 | [email protected] ")" | 15 | [email protected] ")" |
16 | [email protected] "\n" | 16 | [email protected] "\n" |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "where" | 18 | [email protected] "where" |
19 | [email protected] "\n " | 19 | [email protected] "\n " |
20 | [email protected] | 20 | [email protected] |
21 | [email protected] | 21 | [email protected] "for" |
22 | [email protected] "for" | 22 | [email protected] |
23 | [email protected] | 23 | [email protected] "<" |
24 | [email protected] "<" | 24 | [email protected] |
25 | [email protected] | 25 | [email protected] "\'a" |
26 | [email protected] "\'a" | 26 | [email protected] ">" |
27 | [email protected] ">" | 27 | [email protected] " " |
28 | [email protected] " " | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] | 30 | [email protected] |
31 | [email protected] | 31 | [email protected] |
32 | [email protected] | 32 | [email protected] "F" |
33 | [email protected] "F" | 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] | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] | 41 | [email protected] "Fn" |
42 | [email protected] "Fn" | 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] "&" | 47 | [email protected] "\'a" |
48 | [email protected] "\'a" | 48 | [email protected] " " |
49 | [email protected] " " | 49 | [email protected] |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] | 53 | [email protected] "str" |
54 | [email protected] "str" | 54 | [email protected] ")" |
55 | [email protected] ")" | 55 | [email protected] "\n" |
56 | [email protected] "\n" | 56 | [email protected] |
57 | [email protected] | 57 | [email protected] "{" |
58 | [email protected] "{" | 58 | [email protected] " " |
59 | [email protected] " " | 59 | [email protected] "}" |
60 | [email protected] "}" | 60 | [email protected] "\n" |
61 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs index b448c6178..423bc105b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | fn test<F>() | 1 | fn for_trait<F>() |
2 | where | 2 | where |
3 | for<'a> F: Fn(&'a str) | 3 | for<'a> F: Fn(&'a str) |
4 | { } | 4 | { } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index dfb8d57ad..b26ac2d36 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast | |||
@@ -1,4 +1,4 @@ | |||
1 | [email protected]00 | 1 | SOURCE_FILE@0..121 |
2 | [email protected] | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
@@ -29,212 +29,84 @@ [email protected] | |||
29 | [email protected] ")" | 29 | [email protected] ")" |
30 | [email protected] ";" | 30 | [email protected] ";" |
31 | [email protected] "\n" | 31 | [email protected] "\n" |
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "fn" | 33 | [email protected] "type" |
34 | [email protected] " " | 34 | [email protected] " " |
35 | [email protected] | 35 | [email protected] |
36 | [email protected] "foo" | 36 | [email protected] "B" |
37 | [email protected] | 37 | [email protected] " " |
38 | [email protected] "<" | 38 | [email protected] "=" |
39 | [email protected] | 39 | [email protected] " " |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] "T" | 41 | [email protected] "for" |
42 | [email protected] ">" | 42 | [email protected] |
43 | [email protected] | 43 | [email protected] "<" |
44 | [email protected] "(" | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] "\'a" |
46 | [email protected] | 46 | [email protected] ">" |
47 | [email protected] | 47 | [email protected] " " |
48 | [email protected] "_t" | 48 | [email protected] |
49 | [email protected] ":" | 49 | [email protected] "unsafe" |
50 | [email protected] " " | 50 | [email protected] " " |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "&" | 52 | [email protected] "extern" |
53 | [email protected] | 53 | [email protected] " " |
54 | [email protected] | 54 | [email protected] "\"C\"" |
55 | [email protected] | 55 | [email protected] " " |
56 | [email protected] | 56 | [email protected] "fn" |
57 | [email protected] "T" | 57 | [email protected] |
58 | [email protected] ")" | 58 | [email protected] "(" |
59 | [email protected] " " | 59 | [email protected] |
60 | [email protected] | 60 | [email protected] |
61 | [email protected] "where" | 61 | [email protected] "&" |
62 | [email protected] " " | 62 | [email protected] "\'a" |
63 | [email protected] | 63 | [email protected] " " |
64 | [email protected] | 64 | [email protected] |
65 | [email protected] "for" | 65 | [email protected] "(" |
66 | [email protected] | 66 | [email protected] ")" |
67 | [email protected] "<" | 67 | [email protected] ")" |
68 | [email protected] | 68 | [email protected] " " |
69 | [email protected] "\'a" | 69 | [email protected] |
70 | [email protected] ">" | 70 | [email protected] "->" |
71 | [email protected] " " | 71 | [email protected] " " |
72 | [email protected] | 72 | [email protected] |
73 | [email protected] "&" | 73 | [email protected] "(" |
74 | [email protected] "\'a" | 74 | [email protected] ")" |
75 | [email protected] " " | 75 | [email protected] ";" |
76 | [email protected] | 76 | [email protected] "\n" |
77 | [email protected] | 77 | [email protected] |
78 | [email protected] | 78 | [email protected] "type" |
79 | [email protected] | 79 | [email protected] " " |
80 | [email protected] "T" | 80 | [email protected] |
81 | [email protected] ":" | 81 | [email protected] "Obj" |
82 | [email protected] " " | 82 | [email protected] " " |
83 | [email protected] | 83 | [email protected] "=" |
84 | [email protected] | 84 | [email protected] " " |
85 | [email protected] | 85 | [email protected] |
86 | [email protected] | 86 | [email protected] "for" |
87 | [email protected] | 87 | [email protected] |
88 | [email protected] | 88 | [email protected] "<" |
89 | [email protected] "Iterator" | 89 | [email protected] |
90 | [email protected] " " | 90 | [email protected] "\'a" |
91 | [email protected] | 91 | [email protected] ">" |
92 | [email protected] "{" | 92 | [email protected] " " |
93 | [email protected] "}" | 93 | [email protected] |
94 | [email protected] "\n" | 94 | [email protected] |
95 | [email protected] | 95 | [email protected] |
96 | [email protected] "fn" | 96 | [email protected] |
97 | [email protected] " " | 97 | [email protected] "PartialEq" |
98 | [email protected] | 98 | [email protected] |
99 | [email protected] "bar" | 99 | [email protected] "<" |
100 | [email protected] | 100 | [email protected] |
101 | [email protected] "<" | 101 | [email protected] |
102 | [email protected] | 102 | [email protected] "&" |
103 | [email protected] | 103 | [email protected] "\'a" |
104 | [email protected] "T" | 104 | [email protected] " " |
105 | [email protected] ">" | 105 | [email protected] |
106 | [email protected] | 106 | [email protected] |
107 | [email protected] "(" | 107 | [email protected] |
108 | [email protected] | 108 | [email protected] |
109 | [email protected] | 109 | [email protected] "i32" |
110 | [email protected] | 110 | [email protected] ">" |
111 | [email protected] "_t" | 111 | [email protected] ";" |
112 | [email protected] ":" | 112 | [email protected] "\n" |
113 | [email protected] " " | ||
114 | [email protected] | ||
115 | [email protected] "&" | ||
116 | [email protected] | ||
117 | [email protected] | ||
118 | [email protected] | ||
119 | [email protected] | ||
120 | [email protected] "T" | ||
121 | [email protected] ")" | ||
122 | [email protected] " " | ||
123 | [email protected] | ||
124 | [email protected] "where" | ||
125 | [email protected] " " | ||
126 | [email protected] | ||
127 | [email protected] | ||
128 | [email protected] "for" | ||
129 | [email protected] | ||
130 | [email protected] "<" | ||
131 | [email protected] | ||
132 | [email protected] "\'a" | ||
133 | [email protected] ">" | ||
134 | [email protected] " " | ||
135 | [email protected] | ||
136 | [email protected] "&" | ||
137 | [email protected] "\'a" | ||
138 | [email protected] " " | ||
139 | [email protected] "mut" | ||
140 | [email protected] " " | ||
141 | [email protected] | ||
142 | [email protected] | ||
143 | [email protected] | ||
144 | [email protected] | ||
145 | [email protected] "T" | ||
146 | [email protected] ":" | ||
147 | [email protected] " " | ||
148 | [email protected] | ||
149 | [email protected] | ||
150 | [email protected] | ||
151 | [email protected] | ||
152 | [email protected] | ||
153 | [email protected] | ||
154 | [email protected] "Iterator" | ||
155 | [email protected] " " | ||
156 | [email protected] | ||
157 | [email protected] "{" | ||
158 | [email protected] "}" | ||
159 | [email protected] "\n" | ||
160 | [email protected] | ||
161 | [email protected] "fn" | ||
162 | [email protected] " " | ||
163 | [email protected] | ||
164 | [email protected] "baz" | ||
165 | [email protected] | ||
166 | [email protected] "<" | ||
167 | [email protected] | ||
168 | [email protected] | ||
169 | [email protected] "T" | ||
170 | [email protected] ">" | ||
171 | [email protected] | ||
172 | [email protected] "(" | ||
173 | [email protected] | ||
174 | [email protected] | ||
175 | [email protected] | ||
176 | [email protected] "_t" | ||
177 | [email protected] ":" | ||
178 | [email protected] " " | ||
179 | [email protected] | ||
180 | [email protected] "&" | ||
181 | [email protected] | ||
182 | [email protected] | ||
183 | [email protected] | ||
184 | [email protected] | ||
185 | [email protected] "T" | ||
186 | [email protected] ")" | ||
187 | [email protected] " " | ||
188 | [email protected] | ||
189 | [email protected] "where" | ||
190 | [email protected] " " | ||
191 | [email protected] | ||
192 | [email protected] | ||
193 | [email protected] "for" | ||
194 | [email protected] | ||
195 | [email protected] "<" | ||
196 | [email protected] | ||
197 | [email protected] "\'a" | ||
198 | [email protected] ">" | ||
199 | [email protected] " " | ||
200 | [email protected] | ||
201 | [email protected] | ||
202 | [email protected] | ||
203 | [email protected] | ||
204 | [email protected] "<" | ||
205 | [email protected] | ||
206 | [email protected] "&" | ||
207 | [email protected] "\'a" | ||
208 | [email protected] " " | ||
209 | [email protected] | ||
210 | [email protected] | ||
211 | [email protected] | ||
212 | [email protected] | ||
213 | [email protected] "T" | ||
214 | [email protected] " " | ||
215 | [email protected] "as" | ||
216 | [email protected] " " | ||
217 | [email protected] | ||
218 | [email protected] | ||
219 | [email protected] | ||
220 | [email protected] | ||
221 | [email protected] "Baz" | ||
222 | [email protected] ">" | ||
223 | [email protected] "::" | ||
224 | [email protected] | ||
225 | [email protected] | ||
226 | [email protected] "Foo" | ||
227 | [email protected] ":" | ||
228 | [email protected] " " | ||
229 | [email protected] | ||
230 | [email protected] | ||
231 | [email protected] | ||
232 | [email protected] | ||
233 | [email protected] | ||
234 | [email protected] | ||
235 | [email protected] "Iterator" | ||
236 | [email protected] " " | ||
237 | [email protected] | ||
238 | [email protected] "{" | ||
239 | [email protected] "}" | ||
240 | [email protected] "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs index d6774d438..8ac7b9e10 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | type A = for<'a> fn() -> (); | 1 | type A = for<'a> fn() -> (); |
2 | fn foo<T>(_t: &T) where for<'a> &'a T: Iterator {} | 2 | type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); |
3 | fn bar<T>(_t: &T) where for<'a> &'a mut T: Iterator {} | 3 | type Obj = for<'a> PartialEq<&'a i32>; |
4 | fn baz<T>(_t: &T) where for<'a> <&'a T as Baz>::Foo: Iterator {} | ||