Commit 88ea12d
committed
mbe: Refactor diagnostics for missing identifiers
The current messages have the potential to be more accurate; "expected
identifier or string literal" is printed in a few cases where only an
identifier should be expected, and it suggests removing string literals
when that might not solve the problem. Add a new diagnostic for these
kind of errors that gives more context and a better description.
For `count` and `ignore` this should likely be combined with the
diagnositcs for `eat_dollar` to produce a helpful error if they get
anything other than a metavariable first argument. I am planning to do
this in a followup.1 parent b276ff8 commit 88ea12d
File tree
5 files changed
+87
-18
lines changed- compiler/rustc_expand
- src
- mbe
- tests/ui/macros/metavar-expressions
5 files changed
+87
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
543 | 567 | | |
544 | 568 | | |
545 | 569 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
100 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
| |||
241 | 249 | | |
242 | 250 | | |
243 | 251 | | |
244 | | - | |
| 252 | + | |
245 | 253 | | |
246 | 254 | | |
247 | 255 | | |
| |||
279 | 287 | | |
280 | 288 | | |
281 | 289 | | |
282 | | - | |
| 290 | + | |
| 291 | + | |
283 | 292 | | |
284 | 293 | | |
285 | 294 | | |
286 | 295 | | |
| 296 | + | |
287 | 297 | | |
288 | | - | |
289 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
290 | 316 | | |
291 | 317 | | |
292 | 318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
203 | | - | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
208 | 213 | | |
209 | | - | |
| 214 | + | |
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
213 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | | - | |
| 223 | + | |
216 | 224 | | |
217 | 225 | | |
218 | 226 | | |
219 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
220 | 231 | | |
221 | 232 | | |
222 | 233 | | |
0 commit comments