about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-06-10 11:03:45 +0200
committerGitHub <noreply@github.com>2020-06-10 11:03:45 +0200
commite1cd8c41a559276a2a8ff62085ded220cccb88f3 (patch)
treec7ac43b55d2a488d42e9853eb2eb4b3d95a47eb6
parent024f025934a40056364be4a4da4f7e078b419f68 (diff)
parentb05555290ca017e0b40fe6020d69e2177584d5b7 (diff)
downloadrust-e1cd8c41a559276a2a8ff62085ded220cccb88f3.tar.gz
rust-e1cd8c41a559276a2a8ff62085ded220cccb88f3.zip
Rollup merge of #73023 - ayushmishra2005:remove_noisy_suggestion, r=davidtwco
Remove noisy suggestion of hash_map

Remove noisy suggestion of hash_map #72642

fixes #72642
-rw-r--r--src/librustc_resolve/diagnostics.rs4
-rw-r--r--src/test/ui/derived-errors/issue-31997-1.stderr4
-rw-r--r--src/test/ui/hygiene/no_implicit_prelude.stderr4
-rw-r--r--src/test/ui/issues/issue-17546.stderr10
-rw-r--r--src/test/ui/no-implicit-prelude-nested.stderr48
-rw-r--r--src/test/ui/no-implicit-prelude.stderr16
-rw-r--r--src/test/ui/resolve/use_suggestion.stderr8
-rw-r--r--src/test/ui/resolve/use_suggestion_placement.stderr4
8 files changed, 28 insertions, 70 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index a5299afb9c2..bd2ce5a72e8 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -685,7 +685,9 @@ impl<'a> Resolver<'a> {
                                 Res::Def(DefKind::Ctor(..), did) => this.parent(did),
                                 _ => res.opt_def_id(),
                             };
-                            candidates.push(ImportSuggestion { did, descr: res.descr(), path });
+                            if candidates.iter().all(|v: &ImportSuggestion| v.did != did) {
+                                candidates.push(ImportSuggestion { did, descr: res.descr(), path });
+                            }
                         }
                     }
                 }
diff --git a/src/test/ui/derived-errors/issue-31997-1.stderr b/src/test/ui/derived-errors/issue-31997-1.stderr
index a4daf86cc8a..229c5c9e80f 100644
--- a/src/test/ui/derived-errors/issue-31997-1.stderr
+++ b/src/test/ui/derived-errors/issue-31997-1.stderr
@@ -4,12 +4,10 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
 LL |     let mut map = HashMap::new();
    |                   ^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this struct
    |
 LL | use std::collections::HashMap;
    |
-LL | use std::collections::hash_map::HashMap;
-   |
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr
index c0539434d02..990210ffb6b 100644
--- a/src/test/ui/hygiene/no_implicit_prelude.stderr
+++ b/src/test/ui/hygiene/no_implicit_prelude.stderr
@@ -16,9 +16,7 @@ LL |         Vec::new();
    |         ^^^ not found in this scope
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
-help: consider importing one of these items
-   |
-LL |     use std::prelude::v1::Vec;
+help: consider importing this struct
    |
 LL |     use std::vec::Vec;
    |
diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr
index 8bf40790f0b..95939cf6b38 100644
--- a/src/test/ui/issues/issue-17546.stderr
+++ b/src/test/ui/issues/issue-17546.stderr
@@ -30,11 +30,10 @@ LL |     use std::fmt::Result;
    |
 LL |     use std::io::Result;
    |
-LL |     use std::prelude::v1::Result;
-   |
 LL |     use std::result::Result;
    |
-     and 1 other candidate
+LL |     use std::thread::Result;
+   |
 
 error[E0573]: expected type, found variant `Result`
   --> $DIR/issue-17546.rs:30:13
@@ -48,11 +47,10 @@ LL | use std::fmt::Result;
    |
 LL | use std::io::Result;
    |
-LL | use std::prelude::v1::Result;
-   |
 LL | use std::result::Result;
    |
-     and 1 other candidate
+LL | use std::thread::Result;
+   |
 
 error[E0573]: expected type, found variant `NoResult`
   --> $DIR/issue-17546.rs:35:15
diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr
index 8a26366d751..198b630c52c 100644
--- a/src/test/ui/no-implicit-prelude-nested.stderr
+++ b/src/test/ui/no-implicit-prelude-nested.stderr
@@ -15,12 +15,10 @@ error[E0404]: expected trait, found derive macro `Clone`
 LL |         impl Clone for Test {}
    |              ^^^^^ not a trait
    |
-help: consider importing one of these items instead
+help: consider importing this trait instead
    |
 LL |         use std::clone::Clone;
    |
-LL |         use std::prelude::v1::Clone;
-   |
 
 error[E0405]: cannot find trait `Iterator` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:13:14
@@ -28,12 +26,10 @@ error[E0405]: cannot find trait `Iterator` in this scope
 LL |         impl Iterator for Test {}
    |              ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this trait
    |
 LL |         use std::iter::Iterator;
    |
-LL |         use std::prelude::v1::Iterator;
-   |
 
 error[E0405]: cannot find trait `ToString` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:14:14
@@ -41,9 +37,7 @@ error[E0405]: cannot find trait `ToString` in this scope
 LL |         impl ToString for Test {}
    |              ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
-   |
-LL |         use std::prelude::v1::ToString;
+help: consider importing this trait
    |
 LL |         use std::string::ToString;
    |
@@ -60,12 +54,10 @@ error[E0425]: cannot find function `drop` in this scope
 LL |             drop(2)
    |             ^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this function
    |
 LL |         use std::mem::drop;
    |
-LL |         use std::prelude::v1::drop;
-   |
 
 error[E0405]: cannot find trait `Add` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:23:10
@@ -84,12 +76,10 @@ error[E0404]: expected trait, found derive macro `Clone`
 LL |     impl Clone for Test {}
    |          ^^^^^ not a trait
    |
-help: consider importing one of these items instead
+help: consider importing this trait instead
    |
 LL |     use std::clone::Clone;
    |
-LL |     use std::prelude::v1::Clone;
-   |
 
 error[E0405]: cannot find trait `Iterator` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:25:10
@@ -97,12 +87,10 @@ error[E0405]: cannot find trait `Iterator` in this scope
 LL |     impl Iterator for Test {}
    |          ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this trait
    |
 LL |     use std::iter::Iterator;
    |
-LL |     use std::prelude::v1::Iterator;
-   |
 
 error[E0405]: cannot find trait `ToString` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:26:10
@@ -110,9 +98,7 @@ error[E0405]: cannot find trait `ToString` in this scope
 LL |     impl ToString for Test {}
    |          ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
-   |
-LL |     use std::prelude::v1::ToString;
+help: consider importing this trait
    |
 LL |     use std::string::ToString;
    |
@@ -129,12 +115,10 @@ error[E0425]: cannot find function `drop` in this scope
 LL |         drop(2)
    |         ^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this function
    |
 LL |     use std::mem::drop;
    |
-LL |     use std::prelude::v1::drop;
-   |
 
 error[E0405]: cannot find trait `Add` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:38:14
@@ -153,12 +137,10 @@ error[E0404]: expected trait, found derive macro `Clone`
 LL |         impl Clone for Test {}
    |              ^^^^^ not a trait
    |
-help: consider importing one of these items instead
+help: consider importing this trait instead
    |
 LL |         use std::clone::Clone;
    |
-LL |         use std::prelude::v1::Clone;
-   |
 
 error[E0405]: cannot find trait `Iterator` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:40:14
@@ -166,12 +148,10 @@ error[E0405]: cannot find trait `Iterator` in this scope
 LL |         impl Iterator for Test {}
    |              ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this trait
    |
 LL |         use std::iter::Iterator;
    |
-LL |         use std::prelude::v1::Iterator;
-   |
 
 error[E0405]: cannot find trait `ToString` in this scope
   --> $DIR/no-implicit-prelude-nested.rs:41:14
@@ -179,9 +159,7 @@ error[E0405]: cannot find trait `ToString` in this scope
 LL |         impl ToString for Test {}
    |              ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
-   |
-LL |         use std::prelude::v1::ToString;
+help: consider importing this trait
    |
 LL |         use std::string::ToString;
    |
@@ -198,12 +176,10 @@ error[E0425]: cannot find function `drop` in this scope
 LL |             drop(2)
    |             ^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this function
    |
 LL |         use std::mem::drop;
    |
-LL |         use std::prelude::v1::drop;
-   |
 
 error: aborting due to 18 previous errors
 
diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr
index 9cda4f64c79..36a9b65b7d1 100644
--- a/src/test/ui/no-implicit-prelude.stderr
+++ b/src/test/ui/no-implicit-prelude.stderr
@@ -15,12 +15,10 @@ error[E0404]: expected trait, found derive macro `Clone`
 LL | impl Clone for Test {}
    |      ^^^^^ not a trait
    |
-help: consider importing one of these items instead
+help: consider importing this trait instead
    |
 LL | use std::clone::Clone;
    |
-LL | use std::prelude::v1::Clone;
-   |
 
 error[E0405]: cannot find trait `Iterator` in this scope
   --> $DIR/no-implicit-prelude.rs:12:6
@@ -28,12 +26,10 @@ error[E0405]: cannot find trait `Iterator` in this scope
 LL | impl Iterator for Test {}
    |      ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this trait
    |
 LL | use std::iter::Iterator;
    |
-LL | use std::prelude::v1::Iterator;
-   |
 
 error[E0405]: cannot find trait `ToString` in this scope
   --> $DIR/no-implicit-prelude.rs:13:6
@@ -41,9 +37,7 @@ error[E0405]: cannot find trait `ToString` in this scope
 LL | impl ToString for Test {}
    |      ^^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
-   |
-LL | use std::prelude::v1::ToString;
+help: consider importing this trait
    |
 LL | use std::string::ToString;
    |
@@ -60,12 +54,10 @@ error[E0425]: cannot find function `drop` in this scope
 LL |     drop(2)
    |     ^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this function
    |
 LL | use std::mem::drop;
    |
-LL | use std::prelude::v1::drop;
-   |
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/resolve/use_suggestion.stderr b/src/test/ui/resolve/use_suggestion.stderr
index 2fd3d5dccd2..72dda940729 100644
--- a/src/test/ui/resolve/use_suggestion.stderr
+++ b/src/test/ui/resolve/use_suggestion.stderr
@@ -10,12 +10,10 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
 LL |     let x1 = HashMap::new();
    |              ^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this struct
    |
 LL | use std::collections::HashMap;
    |
-LL | use std::collections::hash_map::HashMap;
-   |
 
 error[E0412]: cannot find type `HashMap` in this scope
   --> $DIR/use_suggestion.rs:5:13
@@ -23,12 +21,10 @@ error[E0412]: cannot find type `HashMap` in this scope
 LL |     let y1: HashMap;
    |             ^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this struct
    |
 LL | use std::collections::HashMap;
    |
-LL | use std::collections::hash_map::HashMap;
-   |
 
 error[E0412]: cannot find type `GooMap` in this scope
   --> $DIR/use_suggestion.rs:6:13
diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr
index 9c337f515ad..3f91760fe21 100644
--- a/src/test/ui/resolve/use_suggestion_placement.stderr
+++ b/src/test/ui/resolve/use_suggestion_placement.stderr
@@ -26,12 +26,10 @@ error[E0412]: cannot find type `HashMap` in this scope
 LL |     type Dict<K, V> = HashMap<K, V>;
    |                       ^^^^^^^ not found in this scope
    |
-help: consider importing one of these items
+help: consider importing this struct
    |
 LL | use std::collections::HashMap;
    |
-LL | use std::collections::hash_map::HashMap;
-   |
 
 error: aborting due to 3 previous errors