Suggest defining type parameter when appropriate

```
error[E0412]: cannot find type `T` in this scope
 --> file.rs:3:12
  |
3 | impl Trait<T> for Struct {}
  |     -      ^ not found in this scope
  |     |
  |     help: you might be missing a type parameter: `<T>`
```

Fix #64298.
This commit is contained in:
Esteban Küber 2020-01-21 23:01:21 -08:00
parent 8ad83afe5b
commit 697fdc568e
12 changed files with 178 additions and 66 deletions

View file

@ -26,13 +26,17 @@ 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
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<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
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<dyn>`
error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:9:11
@ -44,7 +48,9 @@ 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
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<dyn>`
error: aborting due to 8 previous errors

View file

@ -4,11 +4,7 @@ error[E0425]: cannot find function `f` in this scope
LL | f();
| ^ not found in this scope
|
help: possible candidates are found in other modules, you can import them into scope
|
LL | use foo::f;
|
LL | use foo::f;
help: possible candidate is found in another module, you can import it into scope
|
LL | use foo::f;
|
@ -32,11 +28,8 @@ LL | use bar::g;
|
LL | use foo::test2::test::g;
|
LL | use foo::test2::test::g;
|
LL | use foo::test::g;
|
and 2 other candidates
error[E0425]: cannot find function `f` in this scope
--> $DIR/globs.rs:61:12
@ -46,6 +39,9 @@ LL | n!(f);
...
LL | n!(f);
| ^ not found in this scope
|
= note: possible candidate is found in another module, you can import it into scope:
foo::f
error[E0425]: cannot find function `f` in this scope
--> $DIR/globs.rs:65:17
@ -55,6 +51,9 @@ LL | n!(f);
...
LL | f
| ^ not found in this scope
|
= note: possible candidate is found in another module, you can import it into scope:
foo::f
error: aborting due to 4 previous errors

View file

@ -2,7 +2,9 @@ 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
| - ^^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, DeviceId`
error[E0412]: cannot find type `DeviceId` in this scope
--> $DIR/issue-58712.rs:8:29

View file

@ -63,6 +63,10 @@ LL | use foo2::Bar;
|
LL | use foo3::Bar;
|
help: you might be missing a type parameter
|
LL | fn test_glob3<Bar>() {
| ^^^^^
error[E0107]: wrong number of const arguments: expected 0, found 1
--> $DIR/privacy-ns1.rs:35:17

View file

@ -6,6 +6,9 @@ LL | generate_mod::check!();
| |
| not found in this scope
| in this macro invocation
|
= note: possible candidate is found in another module, you can import it into scope:
FromOutside
error[E0412]: cannot find type `Outer` in this scope
--> $DIR/generate-mod.rs:9:1
@ -15,18 +18,27 @@ LL | generate_mod::check!();
| |
| not found in this scope
| in this macro invocation
|
= note: possible candidate is found in another module, you can import it into scope:
Outer
error[E0412]: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:12:1
|
LL | #[generate_mod::check_attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: possible candidate is found in another module, you can import it into scope:
FromOutside
error[E0412]: cannot find type `OuterAttr` in this scope
--> $DIR/generate-mod.rs:12:1
|
LL | #[generate_mod::check_attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: possible candidate is found in another module, you can import it into scope:
OuterAttr
warning: cannot find type `FromOutside` in this scope
--> $DIR/generate-mod.rs:16:10

View file

@ -8,6 +8,10 @@ help: possible candidate is found in another module, you can import it into scop
|
LL | use foo::Foo;
|
help: you might be missing a type parameter
|
LL | type Output<Foo> = Option<Foo>;
| ^^^^^
error: aborting due to previous error

View file

@ -2,7 +2,9 @@ error[E0411]: cannot find type `Self` in this scope
--> $DIR/issue-62364-self-ty-arg.rs:5:29
|
LL | type Alias<'a> = Struct<&'a Self>;
| ^^^^ `Self` is only available in impls, traits, and type definitions
| - ^^^^ `Self` is only available in impls, traits, and type definitions
| |
| help: you might be missing a type parameter: `, Self`
error: aborting due to previous error