diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-04 19:42:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-04 19:42:12 +0100 |
| commit | 7fa99bfb7115c5cb1974b37bc34d23f6465b68dc (patch) | |
| tree | 32f11939551b74cffcfa95bf3a03ecd7cca45a53 /tests/ui/error-codes | |
| parent | 1547510dc6f102faa15d672e7b4d856bace87177 (diff) | |
| parent | 02320b502d6ae1398126a068cd1efbb96f87faaa (diff) | |
| download | rust-7fa99bfb7115c5cb1974b37bc34d23f6465b68dc.tar.gz rust-7fa99bfb7115c5cb1974b37bc34d23f6465b68dc.zip | |
Rollup merge of #120556 - fmease:improve-unused-generic-param-diags, r=oli-obk
Improve the diagnostics for unused generic parameters * Don't emit two errors (namely E0091 *and* E0392) for unused type parameters on *lazy* type aliases * Fix the diagnostic help message of E0392 for *lazy* type aliases: Don't talk about the “fields” of lazy type aliases (use the term “body” instead) and don't suggest `PhantomData` for them, it doesn't make much sense * Consolidate the diagnostics for E0091 (unused type parameters in type aliases) and E0392 (unused generic parameters due to bivariance) and make it translatable * Still keep the error codes distinct (for now) * Naturally leads to better diagnostics for E0091 r? ```@oli-obk``` (to ballast your review load :P) or compiler
Diffstat (limited to 'tests/ui/error-codes')
| -rw-r--r-- | tests/ui/error-codes/E0091.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/error-codes/E0392.stderr | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/ui/error-codes/E0091.stderr b/tests/ui/error-codes/E0091.stderr index a596b75e481..c1427ec6686 100644 --- a/tests/ui/error-codes/E0091.stderr +++ b/tests/ui/error-codes/E0091.stderr @@ -1,14 +1,20 @@ -error[E0091]: type parameter `T` is unused +error[E0091]: type parameter `T` is never used --> $DIR/E0091.rs:1:10 | LL | type Foo<T> = u32; | ^ unused type parameter + | + = help: consider removing `T` or referring to it in the body of the type alias + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error[E0091]: type parameter `B` is unused +error[E0091]: type parameter `B` is never used --> $DIR/E0091.rs:2:14 | LL | type Foo2<A, B> = Box<A>; | ^ unused type parameter + | + = help: consider removing `B` or referring to it in the body of the type alias + = help: if you intended `B` to be a const parameter, use `const B: /* Type */` instead error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0392.stderr b/tests/ui/error-codes/E0392.stderr index ecbfd5584d5..9971267e927 100644 --- a/tests/ui/error-codes/E0392.stderr +++ b/tests/ui/error-codes/E0392.stderr @@ -1,11 +1,11 @@ -error[E0392]: parameter `T` is never used +error[E0392]: type parameter `T` is never used --> $DIR/E0392.rs:1:10 | LL | enum Foo<T> { Bar } - | ^ unused parameter + | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - = help: if you intended `T` to be a const parameter, use `const T: usize` instead + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead error: aborting due to 1 previous error |
