Render missing generics suggestion verbosely

This commit is contained in:
Michael Goulet 2023-01-08 23:21:46 +00:00
parent 1bc3683b32
commit 950b47fb96
15 changed files with 103 additions and 52 deletions

View file

@ -167,7 +167,7 @@ fn report_with_use_injections(&mut self, krate: &Crate) {
);
err.emit();
} else if let Some((span, msg, sugg, appl)) = suggestion {
err.span_suggestion(span, msg, sugg, appl);
err.span_suggestion_verbose(span, msg, sugg, appl);
err.emit();
} else if let [segment] = path.as_slice() && is_call {
err.stash(segment.ident.span, rustc_errors::StashKey::CallIntoMethod);

View file

@ -2,9 +2,12 @@ error[E0412]: cannot find type `T` in this scope
--> $DIR/fn-help-with-err-generic-is-not-function.rs:2:13
|
LL | impl Struct<T>
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<T>`
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<T> Struct<T>
| +++
error[E0412]: cannot find type `T` in this scope
--> $DIR/fn-help-with-err-generic-is-not-function.rs:7:5

View file

@ -2,9 +2,12 @@ error[E0412]: cannot find type `DeviceId` in this scope
--> $DIR/issue-58712.rs:6:20
|
LL | impl<H> AddrVec<H, DeviceId> {
| - ^^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, DeviceId`
| ^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<H, DeviceId> AddrVec<H, DeviceId> {
| ++++++++++
error[E0412]: cannot find type `DeviceId` in this scope
--> $DIR/issue-58712.rs:8:29

View file

@ -13,9 +13,12 @@ error[E0412]: cannot find type `VAL` in this scope
--> $DIR/issue-77919.rs:11:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, VAL`
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| +++++
error[E0046]: not all trait items implemented, missing: `VAL`
--> $DIR/issue-77919.rs:11:1

View file

@ -9,10 +9,13 @@ LL | trait Foo<T, T = T> {}
error[E0412]: cannot find type `dyn` in this scope
--> $DIR/issue-86756.rs:5:10
|
LL | fn eq<A, B>() {
| - help: you might be missing a type parameter: `, dyn`
LL | eq::<dyn, Foo>
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn eq<A, B, dyn>() {
| +++++
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-86756.rs:5:15

View file

@ -26,17 +26,23 @@ error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:5:15
|
LL | type A2 = dyn<dyn, dyn>;
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<dyn>`
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A2<dyn> = dyn<dyn, dyn>;
| +++++
error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:5:20
|
LL | type A2 = dyn<dyn, dyn>;
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<dyn>`
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A2<dyn> = dyn<dyn, dyn>;
| +++++
error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:9:11
@ -48,9 +54,12 @@ error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:9:16
|
LL | type A3 = dyn<<dyn as dyn>::dyn>;
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<dyn>`
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A3<dyn> = dyn<<dyn as dyn>::dyn>;
| +++++
error: aborting due to 8 previous errors

View file

@ -7,10 +7,13 @@ LL | m: Vec<Someunknownname<String, ()>>,
error[E0412]: cannot find type `K` in this scope
--> $DIR/type-not-found-in-adt-field.rs:6:8
|
LL | struct OtherStruct {
| - help: you might be missing a type parameter: `<K>`
LL | m: K,
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | struct OtherStruct<K> {
| +++
error: aborting due to 2 previous errors

View file

@ -2,9 +2,12 @@ error[E0412]: cannot find type `Type` in this scope
--> $DIR/ignore-err-impls.rs:6:14
|
LL | impl Generic<Type> for S {}
| - ^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<Type>`
| ^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<Type> Generic<Type> for S {}
| ++++++
error: aborting due to previous error

View file

@ -2,9 +2,12 @@ error[E0412]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:3:12
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| -^ not found in this scope
| |
| help: you might be missing a type parameter: `<N>`
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| +++
error[E0412]: cannot find type `NotDefined` in this scope
--> $DIR/issue-50480.rs:3:15
@ -16,17 +19,23 @@ error[E0412]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:3:12
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| -^ not found in this scope
| |
| help: you might be missing a type parameter: `<N>`
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| +++
error[E0412]: cannot find type `NotDefined` in this scope
--> $DIR/issue-50480.rs:3:15
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| - ^^^^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<NotDefined>`
| ^^^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ++++++++++++
error[E0412]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:12:18

View file

@ -2,9 +2,12 @@ error[E0412]: cannot find type `T` in this scope
--> $DIR/issue-75627.rs:3:26
|
LL | unsafe impl Send for Foo<T> {}
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<T>`
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | unsafe impl<T> Send for Foo<T> {}
| +++
error: aborting due to previous error

View file

@ -30,9 +30,12 @@ error[E0412]: cannot find type `MISC` in this scope
--> $DIR/issue-78372.rs:3:34
|
LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| - ^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, MISC`
| ^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<T, MISC> DispatchFromDyn<Smaht<U, MISC>> for T {}
| ++++++
error[E0658]: use of unstable library feature 'dispatch_from_dyn'
--> $DIR/issue-78372.rs:1:5

View file

@ -1,11 +1,13 @@
error[E0412]: cannot find type `Dst` in this scope
--> $DIR/unknown_dst.rs:20:36
|
LL | fn should_gracefully_handle_unknown_dst() {
| - help: you might be missing a type parameter: `<Dst>`
...
LL | assert::is_transmutable::<Src, Dst, Context>();
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn should_gracefully_handle_unknown_dst<Dst>() {
| +++++
error: aborting due to previous error

View file

@ -1,11 +1,13 @@
error[E0412]: cannot find type `Src` in this scope
--> $DIR/unknown_src.rs:20:31
|
LL | fn should_gracefully_handle_unknown_src() {
| - help: you might be missing a type parameter: `<Src>`
...
LL | assert::is_transmutable::<Src, Dst, Context>();
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn should_gracefully_handle_unknown_src<Src>() {
| +++++
error: aborting due to previous error

View file

@ -1,11 +1,13 @@
error[E0412]: cannot find type `T` in this scope
--> $DIR/autoderef-with-param-env-error.rs:3:5
|
LL | fn foo()
| - help: you might be missing a type parameter: `<T>`
LL | where
LL | T: Send,
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn foo<T>()
| +++
error: aborting due to previous error

View file

@ -1,10 +1,13 @@
error[E0405]: cannot find trait `Oops` in this scope
--> $DIR/issue-104513-ice.rs:3:19
|
LL | fn f() {
| - help: you might be missing a type parameter: `<Oops>`
LL | let _: S<impl Oops> = S;
| ^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn f<Oops>() {
| ++++++
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
--> $DIR/issue-104513-ice.rs:3:14