From 697fdc568e28fbb376567eda4edb2c2a05db68de Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Tue, 21 Jan 2020 23:01:21 -0800 Subject: Suggest defining type parameter when appropriate ``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `` ``` Fix #64298. --- src/test/ui/dyn-trait-compatibility.stderr | 12 +++++++++--- src/test/ui/hygiene/globs.stderr | 15 +++++++-------- src/test/ui/issues/issue-58712.stderr | 4 +++- src/test/ui/privacy/privacy-ns1.stderr | 4 ++++ src/test/ui/proc-macro/generate-mod.stderr | 12 ++++++++++++ src/test/ui/suggestions/no-extern-crate-in-type.stderr | 4 ++++ src/test/ui/type-alias/issue-62364-self-ty-arg.stderr | 4 +++- 7 files changed, 42 insertions(+), 13 deletions(-) (limited to 'src/test') 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; - | ^^^ not found in this scope + | - ^^^ not found in this scope + | | + | help: you might be missing a type parameter: `` error[E0412]: cannot find type `dyn` in this scope --> $DIR/dyn-trait-compatibility.rs:5:20 | LL | type A2 = dyn; - | ^^^ not found in this scope + | - ^^^ not found in this scope + | | + | help: you might be missing a type parameter: `` 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>; - | ^^^ not found in this scope + | - ^^^ not found in this scope + | | + | help: you might be missing a type parameter: `` 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 AddrVec { - | ^^^^^^^^ 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() { + | ^^^^^ 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 = Option; + | ^^^^^ 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 -- cgit 1.4.1-3-g733a5