Commit 3d6129d
committed
Properly account for editions in names
This PR touches a lot of parts. But the main changes are changing
`hir_expand::Name` to be raw edition-dependently and only when necessary
(unrelated to how the user originally wrote the identifier),
and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
(this was done in #17896, but the FIXMEs were fixed here).
It is possible that I missed some cases, but most IDE parts should properly
escape (or not escape) identifiers now.
The rules of thumb are:
- If we show the identifier to the user, its rawness should be determined
by the edition of the edited crate. This is nice for IDE features,
but really important for changes we insert to the source code.
- For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
tests when an edition becomes stable, to avoid churn).
- For debugging tools (helper methods and logs), I used `Edition::LATEST`.1 parent a594a2d commit 3d6129d
File tree
179 files changed
+2480
-1245
lines changed- src/tools/rust-analyzer/crates
- hir-def/src
- body
- hir
- item_tree
- nameres
- tests
- hir-expand/src
- hir-ty/src
- consteval
- diagnostics
- infer
- layout
- mir
- eval
- lower
- hir/src
- term_search
- ide-assists/src
- handlers
- utils
- ide-completion/src
- completions
- attribute
- item_list
- context
- render
- tests
- ide-db/src
- imports
- syntax_helpers
- ide-diagnostics/src
- handlers
- ide-ssr/src
- ide/src
- hover
- inlay_hints
- syntax_highlighting
- parser/src
- rust-analyzer/src
- cli
- syntax-bridge/src
- syntax/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
179 files changed
+2480
-1245
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
| 218 | + | |
213 | 219 | | |
214 | | - | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| |||
Lines changed: 41 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
26 | | - | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | | - | |
| 38 | + | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
| |||
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
42 | | - | |
43 | | - | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
48 | | - | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| 96 | + | |
89 | 97 | | |
90 | | - | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
| |||
113 | 122 | | |
114 | 123 | | |
115 | 124 | | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| |||
173 | 183 | | |
174 | 184 | | |
175 | 185 | | |
| 186 | + | |
176 | 187 | | |
177 | 188 | | |
178 | 189 | | |
179 | 190 | | |
180 | 191 | | |
181 | 192 | | |
182 | | - | |
| 193 | + | |
183 | 194 | | |
184 | 195 | | |
185 | 196 | | |
| |||
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
204 | | - | |
| 215 | + | |
205 | 216 | | |
206 | 217 | | |
207 | 218 | | |
| |||
221 | 232 | | |
222 | 233 | | |
223 | 234 | | |
224 | | - | |
| 235 | + | |
225 | 236 | | |
226 | 237 | | |
227 | | - | |
| 238 | + | |
| 239 | + | |
228 | 240 | | |
229 | 241 | | |
230 | 242 | | |
| |||
259 | 271 | | |
260 | 272 | | |
261 | 273 | | |
262 | | - | |
| 274 | + | |
263 | 275 | | |
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
267 | 279 | | |
268 | | - | |
| 280 | + | |
269 | 281 | | |
270 | 282 | | |
271 | 283 | | |
| |||
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
| 322 | + | |
310 | 323 | | |
311 | 324 | | |
312 | | - | |
| 325 | + | |
313 | 326 | | |
314 | 327 | | |
315 | 328 | | |
| |||
326 | 339 | | |
327 | 340 | | |
328 | 341 | | |
329 | | - | |
| 342 | + | |
330 | 343 | | |
331 | 344 | | |
332 | 345 | | |
| |||
464 | 477 | | |
465 | 478 | | |
466 | 479 | | |
467 | | - | |
468 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
469 | 483 | | |
470 | 484 | | |
471 | 485 | | |
| |||
539 | 553 | | |
540 | 554 | | |
541 | 555 | | |
| 556 | + | |
542 | 557 | | |
543 | 558 | | |
544 | | - | |
| 559 | + | |
545 | 560 | | |
546 | 561 | | |
547 | 562 | | |
| |||
686 | 701 | | |
687 | 702 | | |
688 | 703 | | |
689 | | - | |
| 704 | + | |
| 705 | + | |
690 | 706 | | |
691 | 707 | | |
692 | 708 | | |
693 | | - | |
| 709 | + | |
| 710 | + | |
694 | 711 | | |
695 | 712 | | |
696 | 713 | | |
| |||
701 | 718 | | |
702 | 719 | | |
703 | 720 | | |
704 | | - | |
| 721 | + | |
705 | 722 | | |
706 | 723 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
651 | 651 | | |
652 | 652 | | |
653 | 653 | | |
| 654 | + | |
654 | 655 | | |
655 | 656 | | |
656 | 657 | | |
| |||
717 | 718 | | |
718 | 719 | | |
719 | 720 | | |
720 | | - | |
721 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
422 | | - | |
423 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
424 | 429 | | |
425 | 430 | | |
426 | 431 | | |
427 | 432 | | |
428 | | - | |
| 433 | + | |
429 | 434 | | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
433 | | - | |
| 438 | + | |
434 | 439 | | |
435 | 440 | | |
436 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | | - | |
| 92 | + | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
| |||
461 | 467 | | |
462 | 468 | | |
463 | 469 | | |
464 | | - | |
| 470 | + | |
465 | 471 | | |
466 | 472 | | |
467 | 473 | | |
| |||
577 | 583 | | |
578 | 584 | | |
579 | 585 | | |
580 | | - | |
| 586 | + | |
581 | 587 | | |
582 | 588 | | |
583 | 589 | | |
| |||
616 | 622 | | |
617 | 623 | | |
618 | 624 | | |
619 | | - | |
| 625 | + | |
620 | 626 | | |
621 | 627 | | |
622 | 628 | | |
| |||
0 commit comments