From 9f88d75710b7fbc6d052b2a8dca40c7bd347166e Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Mon, 4 May 2020 18:12:06 -0400 Subject: [PATCH] reword "possible candidate" import suggestion --- src/librustc_resolve/diagnostics.rs | 19 +++++++----- src/librustc_resolve/late/diagnostics.rs | 5 +++- src/test/ui/class-missing-self.stderr | 2 +- src/test/ui/crate-in-paths.stderr | 2 +- ...ssue-56028-there-is-an-enum-variant.stderr | 2 +- src/test/ui/glob-resolve1.stderr | 12 ++++---- src/test/ui/hygiene/globs.stderr | 8 ++--- .../impl-trait/universal_wrong_bounds.stderr | 4 +-- src/test/ui/issues/issue-17546.stderr | 4 +-- src/test/ui/issues/issue-35675.stderr | 4 +-- src/test/ui/issues/issue-37534.stderr | 2 +- src/test/ui/issues/issue-38293.stderr | 2 +- src/test/ui/issues/issue-42944.stderr | 2 +- src/test/ui/issues/issue-4366-2.stderr | 4 +-- src/test/ui/issues/issue-4366.stderr | 2 +- src/test/ui/issues/issue-50599.stderr | 2 +- src/test/ui/lexical-scopes.stderr | 2 +- src/test/ui/lint/use_suggestion_json.stderr | 4 +-- .../ui/macros/macro-outer-attributes.stderr | 2 +- src/test/ui/namespace/namespace-mix.stderr | 8 ++--- src/test/ui/no-implicit-prelude-nested.stderr | 30 +++++++++---------- src/test/ui/no-implicit-prelude.stderr | 10 +++---- .../ui/parser/circular_modules_main.stderr | 2 +- src/test/ui/privacy/privacy-ns1.stderr | 6 ++-- src/test/ui/privacy/privacy-ns2.stderr | 6 ++-- .../attributes-on-modules-fail.stderr | 4 +-- src/test/ui/proc-macro/generate-mod.stderr | 8 ++--- src/test/ui/proc-macro/mixed-site-span.stderr | 2 +- .../ui/resolve/enums-are-namespaced-xc.stderr | 6 ++-- src/test/ui/resolve/issue-16058.stderr | 2 +- src/test/ui/resolve/issue-17518.stderr | 2 +- src/test/ui/resolve/issue-21221-1.stderr | 6 ++-- src/test/ui/resolve/issue-21221-2.stderr | 2 +- src/test/ui/resolve/issue-21221-3.stderr | 2 +- src/test/ui/resolve/issue-21221-4.stderr | 2 +- src/test/ui/resolve/issue-3907.stderr | 2 +- src/test/ui/resolve/privacy-enum-ctor.stderr | 12 ++++---- .../ui/resolve/privacy-struct-ctor.stderr | 2 +- .../resolve/resolve-primitive-fallback.stderr | 2 +- .../resolve/use_suggestion_placement.stderr | 6 ++-- .../issue-52202-use-suggestions.stderr | 2 +- src/test/ui/self/self_type_keyword.stderr | 2 +- src/test/ui/span/issue-35987.stderr | 2 +- .../no-extern-crate-in-type.stderr | 2 +- .../raw-name-use-suggestion.stderr | 2 +- src/test/ui/use/use-super-global-path.stderr | 2 +- 46 files changed, 112 insertions(+), 106 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 450293b991bde..8e82480c6305d 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -47,6 +47,7 @@ impl TypoSuggestion { /// A free importable items suggested in case of resolution failure. crate struct ImportSuggestion { pub did: Option, + pub descr: &'static str, pub path: Path, } @@ -652,7 +653,7 @@ impl<'a> Resolver<'a> { Res::Def(DefKind::Ctor(..), did) => this.parent(did), _ => res.opt_def_id(), }; - candidates.push(ImportSuggestion { did, path }); + candidates.push(ImportSuggestion { did, descr: res.descr(), path }); } } } @@ -1445,7 +1446,7 @@ fn find_span_immediately_after_crate_name( crate fn show_candidates( err: &mut DiagnosticBuilder<'_>, // This is `None` if all placement locations are inside expansions - span: Option, + use_placement_span: Option, candidates: &[ImportSuggestion], better: bool, found_use: bool, @@ -1453,6 +1454,7 @@ crate fn show_candidates( if candidates.is_empty() { return; } + // we want consistent results across executions, but candidates are produced // by iterating through a hash map, so make sure they are ordered: let mut path_strings: Vec<_> = @@ -1460,14 +1462,15 @@ crate fn show_candidates( path_strings.sort(); path_strings.dedup(); - let better = if better { "better " } else { "" }; - let msg_diff = match path_strings.len() { - 1 => " is found in another module, you can import it", - _ => "s are found in other modules, you can import them", + let (determiner, kind) = if candidates.len() == 1 { + ("this", candidates[0].descr) + } else { + ("one of these", "items") }; - let msg = format!("possible {}candidate{} into scope", better, msg_diff); + let instead = if better { " instead" } else { "" }; + let msg = format!("consider importing {} {}{}", determiner, kind, instead); - if let Some(span) = span { + if let Some(span) = use_placement_span { for candidate in &mut path_strings { // produce an additional newline to separate the new use statement // from the directly following item. diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index f6213189d9443..bd77f9e1c9c97 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -873,7 +873,10 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { let module_def_id = module.def_id().unwrap(); if module_def_id == def_id { let path = Path { span: name_binding.span, segments: path_segments }; - result = Some((module, ImportSuggestion { did: Some(def_id), path })); + result = Some(( + module, + ImportSuggestion { did: Some(def_id), descr: "module", path }, + )); } else { // add the module to the lookup if seen_modules.insert(module_def_id) { diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index 681d0ffea8be8..d501200d73cec 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function `sleep` in this scope LL | sleep(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use std::thread::sleep; | diff --git a/src/test/ui/crate-in-paths.stderr b/src/test/ui/crate-in-paths.stderr index 38d222f980d2d..c3aa135f77d5b 100644 --- a/src/test/ui/crate-in-paths.stderr +++ b/src/test/ui/crate-in-paths.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `Foo` in this scope LL | Foo; | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use crate::bar::Foo; | diff --git a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr index 792b36e00bbfe..9429a0b576532 100644 --- a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr +++ b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -22,7 +22,7 @@ error[E0425]: cannot find value `Set` in this scope LL | fn setup() -> Set { Set } | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use AffixHeart::Set; | diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index efbd53fd223a4..995da6cc1f975 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `fpriv` in this scope LL | fpriv(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use bar::fpriv; | @@ -15,7 +15,7 @@ error[E0425]: cannot find function `epriv` in this scope LL | epriv(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use bar::epriv; | @@ -32,7 +32,7 @@ error[E0425]: cannot find value `C` in this scope LL | C; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use bar::C; | @@ -56,7 +56,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use bar::A; | @@ -74,7 +74,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use bar::C; | @@ -92,7 +92,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this type alias | LL | use bar::D; | diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr index 153ad8cbecfcd..8f6b7aca8fda8 100644 --- a/src/test/ui/hygiene/globs.stderr +++ b/src/test/ui/hygiene/globs.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `f` in this scope LL | f(); | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing one of these items | LL | use foo::f; | @@ -23,7 +23,7 @@ LL | | } | |_____- in this macro invocation | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use bar::g; | @@ -41,7 +41,7 @@ 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: + = note: consider importing one of these items: foo::f = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -54,7 +54,7 @@ LL | n!(f); LL | f | ^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing one of these items: foo::f = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index 32b638dc465c5..3b1a5e5f4ad00 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found derive macro `Debug` LL | fn wants_debug(g: impl Debug) { } | ^^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::fmt::Debug; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Debug` LL | fn wants_display(g: impl Debug) { } | ^^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::fmt::Debug; | diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 1236bbcdbf6ee..8bf40790f0b24 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -24,7 +24,7 @@ error[E0573]: expected type, found variant `Result` LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | @@ -42,7 +42,7 @@ error[E0573]: expected type, found variant `Result` LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | diff --git a/src/test/ui/issues/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr index a9a27da55b1a1..8637e574c5ecb 100644 --- a/src/test/ui/issues/issue-35675.stderr +++ b/src/test/ui/issues/issue-35675.stderr @@ -15,7 +15,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in thi LL | Apple(5) | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use Fruit::Apple; | @@ -35,7 +35,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in thi LL | Apple(5) | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use Fruit::Apple; | diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr index b82e7b38914ac..5d008cf24dc90 100644 --- a/src/test/ui/issues/issue-37534.stderr +++ b/src/test/ui/issues/issue-37534.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found derive macro `Hash` LL | struct Foo { } | ^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::hash::Hash; | diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr index cc3c72b496f5f..d2450ab125062 100644 --- a/src/test/ui/issues/issue-38293.stderr +++ b/src/test/ui/issues/issue-38293.stderr @@ -10,7 +10,7 @@ error[E0423]: expected function, found module `baz` LL | baz(); | ^^^ not a function | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this function instead | LL | use bar::baz; | diff --git a/src/test/ui/issues/issue-42944.stderr b/src/test/ui/issues/issue-42944.stderr index c71194f41c114..e7e251e39c04f 100644 --- a/src/test/ui/issues/issue-42944.stderr +++ b/src/test/ui/issues/issue-42944.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in this sc LL | B(()); | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple struct | LL | use foo::B; | diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr index 60a1155c614f6..ecee595d4ab6a 100644 --- a/src/test/ui/issues/issue-4366-2.stderr +++ b/src/test/ui/issues/issue-4366-2.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Bar` in this scope LL | fn sub() -> Bar { 1 } | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this type alias | LL | use a::b::Bar; | @@ -15,7 +15,7 @@ error[E0423]: expected function, found module `foo` LL | foo(); | ^^^ not a function | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo::foo; | diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr index d931d51911756..a094180572daa 100644 --- a/src/test/ui/issues/issue-4366.stderr +++ b/src/test/ui/issues/issue-4366.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `foo` in this scope LL | fn sub() -> isize { foo(); 1 } | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo::foo; | diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr index 378c57011ac50..7ec567a06f09d 100644 --- a/src/test/ui/issues/issue-50599.stderr +++ b/src/test/ui/issues/issue-50599.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64` LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | ^^^^^^^ not found in `std::f64` | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::f32::consts::LOG10_2; | diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 6bb0877e9b9ba..dce7054517030 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -4,7 +4,7 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` LL | let t = T { i: 0 }; | ^ not a struct, variant or union type | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this struct instead | LL | use T; | diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index 1d0b2a554f19a..d0d91bb61f457 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -94,7 +94,7 @@ mod foo { ], "children": [ { - "message": "possible candidates are found in other modules, you can import them into scope", + "message": "consider importing one of these items", "code": null, "level": "help", "spans": [ @@ -385,7 +385,7 @@ mod foo { \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let x: Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: possible candidates are found in other modules, you can import them into scope\u001b[0m +\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these items\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::binary_heap::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index 86a6baca05324..8e064d980afab 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `bar` in module `a` LL | a::bar(); | ^^^ not found in `a` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use b::bar; | diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index f82c83fd5b0ba..c80055f00d7d9 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -12,7 +12,7 @@ help: a tuple struct with a similar name exists | LL | check(m1::TS); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m2::S; | @@ -35,7 +35,7 @@ help: a tuple struct with a similar name exists | LL | check(xm1::TS); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m2::S; | @@ -57,7 +57,7 @@ help: a tuple variant with a similar name exists | LL | check(m7::TV); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m8::V; | @@ -79,7 +79,7 @@ help: a tuple variant with a similar name exists | LL | check(xm7::TV); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m8::V; | diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr index e57d8af5f99b9..8a26366d751d3 100644 --- a/src/test/ui/no-implicit-prelude-nested.stderr +++ b/src/test/ui/no-implicit-prelude-nested.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -28,7 +28,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -41,7 +41,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -60,7 +60,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | @@ -73,7 +73,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -84,7 +84,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -97,7 +97,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -110,7 +110,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -129,7 +129,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | @@ -142,7 +142,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -153,7 +153,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -166,7 +166,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -179,7 +179,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -198,7 +198,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr index 8b99529f4dd7c..9cda4f64c79d0 100644 --- a/src/test/ui/no-implicit-prelude.stderr +++ b/src/test/ui/no-implicit-prelude.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -28,7 +28,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -41,7 +41,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -60,7 +60,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index 90f81c64835b7..5d4db8c31a2c3 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function `say_hello` in module `circular_modules_hello LL | circular_modules_hello::say_hello(); | ^^^^^^^^^ not found in `circular_modules_hello` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use circular_modules_hello::say_hello; | diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 45ca00f55ab59..4d2af735fa6b9 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -11,7 +11,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -33,7 +33,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo1::Bar; | @@ -55,7 +55,7 @@ help: a struct with a similar name exists | LL | let _x: Box; | ^^^ -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo1::Bar; | diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 0c826147a1ca7..f1aa523742ae4 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -4,7 +4,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar LL | Bar(); | ^^^ not a function, tuple struct or tuple variant | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -26,7 +26,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -45,7 +45,7 @@ help: use `=` if you meant to assign | LL | let _x = Bar(); | ^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | diff --git a/src/test/ui/proc-macro/attributes-on-modules-fail.stderr b/src/test/ui/proc-macro/attributes-on-modules-fail.stderr index f0ab107e15178..b37f1bd393c6f 100644 --- a/src/test/ui/proc-macro/attributes-on-modules-fail.stderr +++ b/src/test/ui/proc-macro/attributes-on-modules-fail.stderr @@ -50,7 +50,7 @@ help: a type alias with a similar name exists | LL | type A = A; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use Y; | @@ -65,7 +65,7 @@ help: a type alias with a similar name exists | LL | type A = A; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use m::X; | diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr index 5a329639e8eee..9b946b5e2449e 100644 --- a/src/test/ui/proc-macro/generate-mod.stderr +++ b/src/test/ui/proc-macro/generate-mod.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: FromOutside = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -14,7 +14,7 @@ error[E0412]: cannot find type `Outer` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: Outer = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -24,7 +24,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: FromOutside = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -34,7 +34,7 @@ error[E0412]: cannot find type `OuterAttr` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: OuterAttr = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr index 30a4cd7c116a6..81d2113c3b2df 100644 --- a/src/test/ui/proc-macro/mixed-site-span.stderr +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -27,7 +27,7 @@ LL | pass_dollar_crate!(); | ^^^^^^^^^^^^^^^^^^^^^ not found in `$crate` | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use ItemUse; | diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 61816709ecc5d..621686dd292d6 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums` LL | let _ = namespaced_enums::A; | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit variant | LL | use namespaced_enums::Foo::A; | @@ -15,7 +15,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate ` LL | let _ = namespaced_enums::B(10); | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use namespaced_enums::Foo::B; | @@ -26,7 +26,7 @@ error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced LL | let _ = namespaced_enums::C { a: 10 }; | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this variant | LL | use namespaced_enums::Foo::C; | diff --git a/src/test/ui/resolve/issue-16058.stderr b/src/test/ui/resolve/issue-16058.stderr index 913009ce51c1a..c47d22cef5f6c 100644 --- a/src/test/ui/resolve/issue-16058.stderr +++ b/src/test/ui/resolve/issue-16058.stderr @@ -4,7 +4,7 @@ error[E0574]: expected struct, variant or union type, found enum `Result` LL | Result { | ^^^^^^ not a struct, variant or union type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 6098d4f490155..034d0d01bfb80 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -4,7 +4,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope LL | E { name: "foobar" }; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this variant | LL | use SomeEnum::E; | diff --git a/src/test/ui/resolve/issue-21221-1.stderr b/src/test/ui/resolve/issue-21221-1.stderr index 27fd612faca9c..d3e1953435359 100644 --- a/src/test/ui/resolve/issue-21221-1.stderr +++ b/src/test/ui/resolve/issue-21221-1.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Mul` in this scope LL | impl Mul for Foo { | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use mul1::Mul; | @@ -19,7 +19,7 @@ error[E0412]: cannot find type `Mul` in this scope LL | fn getMul() -> Mul { | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use mul1::Mul; | @@ -43,7 +43,7 @@ error[E0405]: cannot find trait `Div` in this scope LL | impl Div for Foo { | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Div; | diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index b360fda6f9d7c..f9263d2af5026 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `T` in this scope LL | impl T for Foo { } | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use foo::bar::T; | diff --git a/src/test/ui/resolve/issue-21221-3.stderr b/src/test/ui/resolve/issue-21221-3.stderr index f2c94d467e25e..f12e5b09bacd0 100644 --- a/src/test/ui/resolve/issue-21221-3.stderr +++ b/src/test/ui/resolve/issue-21221-3.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope LL | impl OuterTrait for Foo {} | ^^^^^^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use issue_21221_3::outer::OuterTrait; | diff --git a/src/test/ui/resolve/issue-21221-4.stderr b/src/test/ui/resolve/issue-21221-4.stderr index 0b1527f91bd00..fc15444d0c0fb 100644 --- a/src/test/ui/resolve/issue-21221-4.stderr +++ b/src/test/ui/resolve/issue-21221-4.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `T` in this scope LL | impl T for Foo {} | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use issue_21221_4::T; | diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 16436a9accc85..4d0b0af58a320 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -9,7 +9,7 @@ help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` | LL | type Foo = dyn issue_3907::Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use issue_3907::Foo; | diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 30ac783ea2f7e..d9b1b9c59558a 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -67,7 +67,7 @@ LL | let _: E = E::Struct; | ^^^^^^^^^ LL | let _: E = E::Unit; | ^^^^^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::f32::consts::E; | @@ -99,7 +99,7 @@ LL | let _: E = E::Struct; | ^^^^^^^^^ LL | let _: E = E::Unit; | ^^^^^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::f32::consts::E; | @@ -130,7 +130,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -163,7 +163,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Fn; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -181,7 +181,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Struct; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -210,7 +210,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Unit {}; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index baf7dd84eb09d..e0305b129a881 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -33,7 +33,7 @@ error[E0423]: expected value, found struct `xcrate::S` LL | xcrate::S; | ^^^^^^^^^ constructor is not visible here due to private fields | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this tuple struct instead | LL | use m::S; | diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 9d381a8a94e3f..8611306e82d03 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -10,7 +10,7 @@ error[E0412]: cannot find type `u8` in the crate root LL | let _: ::u8; | ^^ not found in the crate root | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this builtin type | LL | use std::primitive::u8; | diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index ef451ea847a37..9c337f515adbc 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Path` in this scope LL | type Bar = Path; | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use std::path::Path; | @@ -15,7 +15,7 @@ error[E0425]: cannot find value `A` in this scope LL | let _ = A; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this constant | LL | use m::A; | @@ -26,7 +26,7 @@ error[E0412]: cannot find type `HashMap` in this scope LL | type Dict = HashMap; | ^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::collections::HashMap; | diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr index c712fd048f191..38cd9713d1a13 100644 --- a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -4,7 +4,7 @@ error[E0422]: cannot find struct, variant or union type `Drain` in this scope LL | let _d = Drain {}; | ^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use crate::plumbing::Drain; | diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index fa603276c8eb5..7997cdc2957b4 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -66,7 +66,7 @@ error[E0531]: cannot find unit struct, unit variant or constant `Self` in this s LL | mut Self => (), | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use foo::Self; | diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index 3245d8655e87d..2bc3ff4c3b619 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found type parameter `Add` LL | impl Add for Foo { | ^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::ops::Add; | 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 22aad3b0a9f58..876eef2b6249a 100644 --- a/src/test/ui/suggestions/no-extern-crate-in-type.stderr +++ b/src/test/ui/suggestions/no-extern-crate-in-type.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Foo` in this scope LL | type Output = Option; | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use foo::Foo; | diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.stderr b/src/test/ui/suggestions/raw-name-use-suggestion.stderr index 62b76318e09b5..7447cf87ce168 100644 --- a/src/test/ui/suggestions/raw-name-use-suggestion.stderr +++ b/src/test/ui/suggestions/raw-name-use-suggestion.stderr @@ -26,7 +26,7 @@ error[E0425]: cannot find function `r#break` in this scope LL | r#break(); | ^^^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use foo::r#break; | diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index 7f98ac7cd0fef..edde26c1fc15d 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -22,7 +22,7 @@ error[E0425]: cannot find function `main` in this scope LL | main(); | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use main; |