5ea62560f2
Resolve associated item bindings by namespace This is the 3rd commit split off from #118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc80af4666f26d7ad51fe34a0e2dd0b8b74) & slightly adapted (removed supertraits from a UI test, cc #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 #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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl | ||
README.md |
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.