about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-01-21 23:01:21 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-01-26 10:57:18 -0800
commit697fdc568e28fbb376567eda4edb2c2a05db68de (patch)
tree2353388fac15725d1de0ef61d3c729dda69ba9ff /src/test
parent8ad83afe5bcfa983a24b6f720c9ef389350f414b (diff)
downloadrust-697fdc568e28fbb376567eda4edb2c2a05db68de.tar.gz
rust-697fdc568e28fbb376567eda4edb2c2a05db68de.zip
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/dyn-trait-compatibility.stderr12
-rw-r--r--src/test/ui/hygiene/globs.stderr15
-rw-r--r--src/test/ui/issues/issue-58712.stderr4
-rw-r--r--src/test/ui/privacy/privacy-ns1.stderr4
-rw-r--r--src/test/ui/proc-macro/generate-mod.stderr12
-rw-r--r--src/test/ui/suggestions/no-extern-crate-in-type.stderr4
-rw-r--r--src/test/ui/type-alias/issue-62364-self-ty-arg.stderr4
7 files changed, 42 insertions, 13 deletions
diff --git a/src/test/ui/dyn-trait-compatibility.stderr b/src/test/ui/dyn-trait-compatibility.stderr
index 7210a11f350..8fe8ceb4d0a 100644
--- a/src/test/ui/dyn-trait-compatibility.stderr
+++ b/src/test/ui/dyn-trait-compatibility.stderr
@@ -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
 
diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr
index 4b382a2b209..f9fbf295aec 100644
--- a/src/test/ui/hygiene/globs.stderr
+++ b/src/test/ui/hygiene/globs.stderr
@@ -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
 
diff --git a/src/test/ui/issues/issue-58712.stderr b/src/test/ui/issues/issue-58712.stderr
index 6164ad7ee19..87c16aa993b 100644
--- a/src/test/ui/issues/issue-58712.stderr
+++ b/src/test/ui/issues/issue-58712.stderr
@@ -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
diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr
index 45ca00f55ab..66e9b78f676 100644
--- a/src/test/ui/privacy/privacy-ns1.stderr
+++ b/src/test/ui/privacy/privacy-ns1.stderr
@@ -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
diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr
index 829d8bf4c81..fe53fb242f4 100644
--- a/src/test/ui/proc-macro/generate-mod.stderr
+++ b/src/test/ui/proc-macro/generate-mod.stderr
@@ -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
diff --git a/src/test/ui/suggestions/no-extern-crate-in-type.stderr b/src/test/ui/suggestions/no-extern-crate-in-type.stderr
index 22aad3b0a9f..0a73a269134 100644
--- a/src/test/ui/suggestions/no-extern-crate-in-type.stderr
+++ b/src/test/ui/suggestions/no-extern-crate-in-type.stderr
@@ -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
 
diff --git a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
index 5ed27760a82..cae41672ead 100644
--- a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
+++ b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
@@ -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