diff options
| author | Michael Goulet <michael@errs.io> | 2025-03-08 20:20:15 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-03-08 20:44:57 +0000 |
| commit | ceb040135dedd7de4b3a77d25c5b4f485b6baf9d (patch) | |
| tree | 22264274b41b9e25450e7d9729d5673f284538f9 /tests/ui/dyn-keyword | |
| parent | bca0ab8d7a7b06406966c7a710e9f4ad61d064fb (diff) | |
| download | rust-ceb040135dedd7de4b3a77d25c5b4f485b6baf9d.tar.gz rust-ceb040135dedd7de4b3a77d25c5b4f485b6baf9d.zip | |
Fix suggestion when there are generics, inline some things
Diffstat (limited to 'tests/ui/dyn-keyword')
| -rw-r--r-- | tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs | 7 | ||||
| -rw-r--r-- | tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.stderr | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs index dcbed027c74..4d573b90d60 100644 --- a/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs +++ b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs @@ -31,4 +31,11 @@ where Trait:, {} //~^ ERROR expected a type, found a trait +struct HasGenerics<T> { + f: Trait, + //~^ ERROR expected a type, found a trait + t: T, +} + + fn main() {} diff --git a/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.stderr b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.stderr index 16e48ef3a12..9584147bbc7 100644 --- a/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.stderr +++ b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.stderr @@ -47,6 +47,18 @@ LL ~ B(T), | error[E0782]: expected a type, found a trait + --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:35:8 + | +LL | f: Trait, + | ^^^^^ + | +help: you might be missing a type parameter + | +LL ~ struct HasGenerics<T, U: Trait> { +LL ~ f: U, + | + +error[E0782]: expected a type, found a trait --> $DIR/suggest-struct-or-union-add-generic-impl-trait.rs:31:5 | LL | Trait:, {} @@ -57,6 +69,6 @@ help: you can add the `dyn` keyword if you want a trait object LL | dyn Trait:, {} | +++ -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0782`. |
