summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-21 12:33:33 +0000
committerbors <bors@rust-lang.org>2025-01-21 12:33:33 +0000
commitcd805f09ffbfa3896c8f50a619de9b67e1d9f3c3 (patch)
tree47b1e83d312b17963558a651199af49e065bdb24 /tests/ui/error-codes
parenta7a6c64a657f68113301c2ffe0745b49a16442d1 (diff)
parent824a867e82b540503f8ae1f589445d9f9a8ce941 (diff)
downloadrust-cd805f09ffbfa3896c8f50a619de9b67e1d9f3c3.tar.gz
rust-cd805f09ffbfa3896c8f50a619de9b67e1d9f3c3.zip
Auto merge of #133830 - compiler-errors:span-key, r=lcnr
Rework dyn trait lowering to stop being so intertwined with trait alias expansion

This PR reworks the trait object lowering code to stop handling trait aliases so funky, and removes the `TraitAliasExpander` in favor of a much simpler design. This refactoring is important for making the code that I'm writing in https://github.com/rust-lang/rust/pull/133397 understandable and easy to maintain, so the diagnostics regressions are IMO inevitable.

In the old trait object lowering code, we used to be a bit sloppy with the lists of traits in their unexpanded and expanded forms. This PR largely rewrites this logic to expand the trait aliases *once* and handle them more responsibly throughout afterwards.

Please review this with whitespace disabled.

r? lcnr
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0225.stderr4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/ui/error-codes/E0225.stderr b/tests/ui/error-codes/E0225.stderr
index a4b33a0b7b4..e6781282c8f 100644
--- a/tests/ui/error-codes/E0225.stderr
+++ b/tests/ui/error-codes/E0225.stderr
@@ -20,8 +20,8 @@ LL | trait Foo = std::io::Read + std::io::Write;
 LL |     let _: Box<dyn Foo>;
    |                    ^^^
    |                    |
-   |                    trait alias used in trait object type (additional use)
-   |                    trait alias used in trait object type (first use)
+   |                    first non-auto trait comes from this alias
+   |                    second non-auto trait comes from this alias
    |
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>