about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-22 16:02:28 +0200
committerGitHub <noreply@github.com>2025-05-22 16:02:28 +0200
commit3216098e5344ee0f2e387e3901c4ff24ba40bf2c (patch)
treec9449cedf11c46aeef00c8e2a37971eb754b5313 /tests/ui/error-codes
parent706dc7091628735e29c9061df6ecfdb38c55b651 (diff)
parent8c37c8c3e6133ae431bc4a5aec1c7b21a3134969 (diff)
downloadrust-3216098e5344ee0f2e387e3901c4ff24ba40bf2c.tar.gz
rust-3216098e5344ee0f2e387e3901c4ff24ba40bf2c.zip
Rollup merge of #140218 - fmease:hirtylo-clean-up-path-low, r=compiler-errors
HIR ty lowering: Clean up & refactor the lowering of type-relative paths

While rebasing #126651 I realized that HIR ty lowering could benefit from some *spring cleaning* now that it's been extended to handle RTN and mGCA paths.

More seriously, similar to my merged PR #118668 which unified the handling of all *associated item constraints* (assoc ty, const (ACE) & fn (RTN)), this PR (commit https://github.com/rust-lang/rust/pull/140218/commits/695fcf517d8864b4812225643ef8cfc036ba9f61) partially[^1] deduplicates the resolution code for all *type-relative paths* (assoc ty, const (mGCA) & fn (RTN)).

**Why**? DRY'ing that part of the code means PR #126651 will automatically support RTN paths like `Ty::AssocTy::assoc_fn(..)` and it also implies shared diagnostic code and thus better diagnostics for RTN.

---

The other commits represent cleanups, renamings, moves. More notably, I've renamed path lowering methods to be a lot more descriptive, so ones lowering `QPath(Resolved)` paths now have `_resolved_` in their name and ones lowering `QPath(TypeRelative)` paths now have `_type_relative_` in their name. This should make it stupidly obvious what their purpose is.

---

Best reviewed commit by commit. The changes are close to trivial but the diff might make it look hairier.
r? compiler-errors

[^1]: Sadly, I couldn't unify as much compared to the other PR without introducing unnecessary `unreachable!()`s or rendering the code otherwise illegible with flags and micro helper traits.
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0223.stderr8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/ui/error-codes/E0223.stderr b/tests/ui/error-codes/E0223.stderr
index e985a4c9bf0..fbfdce5689a 100644
--- a/tests/ui/error-codes/E0223.stderr
+++ b/tests/ui/error-codes/E0223.stderr
@@ -2,7 +2,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/E0223.rs:8:14
    |
 LL |     let foo: MyTrait::X;
-   |              ^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as MyTrait>::X`
+   |              ^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let foo: MyTrait::X;
+LL +     let foo: <MyStruct as MyTrait>::X;
+   |
 
 error: aborting due to 1 previous error