This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 5ea6256
committed
Auto merge of rust-lang#118668 - fmease:resolve-assoc-item-bindings-by-namespace, r=compiler-errors
Resolve associated item bindings by namespace
This is the 3rd commit split off from rust-lang#118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc) & slightly adapted (removed supertraits from a UI test, cc rust-lang#118040).
> * Resolve all assoc item bindings (type, const, fn (feature `return_type_notation`)) by namespace instead of trying to resolve a type first (in the non-RTN case) and falling back to consts afterwards. This is consistent with RTN. E.g., for `Tr<K = {…}>` we now always try to look up assoc consts (this extends to supertrait bounds). This gets rid of assoc tys shadowing assoc consts in assoc item bindings which is undesirable & inconsistent (types and consts live in different namespaces after all)
> * Consolidate the resolution of assoc {ty, const} bindings and RTN (dedup, better diags for RTN)
> * Fix assoc consts being labeled as assoc *types* in several diagnostics
> * Make a bunch of diagnostics translatable
Fixes rust-lang#112560 (error → pass).
As discussed
r? `@compiler-errors`
---
**Addendum**: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.File tree
27 files changed
+598
-416
lines changed- compiler/rustc_hir_analysis
- src
- astconv
- tests/ui
- associated-consts
- associated-type-bounds
- return-type-notation
- async-await/return-type-notation
- const-generics
- error-codes
- feature-gates
27 files changed
+598
-416
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
4 | | - | |
5 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
6 | 26 | | |
7 | 27 | | |
8 | 28 | | |
| |||
280 | 300 | | |
281 | 301 | | |
282 | 302 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 303 | | |
288 | 304 | | |
289 | 305 | | |
| |||
294 | 310 | | |
295 | 311 | | |
296 | 312 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
269 | 265 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
278 | 270 | | |
279 | | - | |
| 271 | + | |
280 | 272 | | |
281 | 273 | | |
282 | | - | |
| 274 | + | |
283 | 275 | | |
284 | 276 | | |
285 | 277 | | |
286 | | - | |
287 | | - | |
| 278 | + | |
| 279 | + | |
288 | 280 | | |
289 | 281 | | |
290 | 282 | | |
| 283 | + | |
291 | 284 | | |
292 | 285 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 286 | + | |
297 | 287 | | |
298 | 288 | | |
299 | 289 | | |
300 | 290 | | |
301 | 291 | | |
302 | 292 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
317 | 301 | | |
318 | 302 | | |
319 | 303 | | |
| |||
340 | 324 | | |
341 | 325 | | |
342 | 326 | | |
343 | | - | |
| 327 | + | |
344 | 328 | | |
345 | 329 | | |
346 | 330 | | |
| |||
467 | 451 | | |
468 | 452 | | |
469 | 453 | | |
470 | | - | |
| 454 | + | |
471 | 455 | | |
472 | 456 | | |
473 | 457 | | |
| |||
492 | 476 | | |
493 | 477 | | |
494 | 478 | | |
495 | | - | |
496 | | - | |
497 | 479 | | |
498 | | - | |
| 480 | + | |
499 | 481 | | |
500 | 482 | | |
501 | 483 | | |
502 | 484 | | |
503 | | - | |
| 485 | + | |
504 | 486 | | |
505 | 487 | | |
506 | 488 | | |
507 | 489 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | 490 | | |
550 | 491 | | |
551 | | - | |
552 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
553 | 496 | | |
554 | 497 | | |
555 | 498 | | |
556 | 499 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | 500 | | |
567 | 501 | | |
568 | 502 | | |
| |||
0 commit comments