]> git.lizzy.rs Git - rust.git/commitdiff
Remove noisy suggestion of hash_map #72642
authorAyush Kumar Mishra <ayush.k.mishra@xcelenergy.com>
Fri, 5 Jun 2020 09:57:37 +0000 (15:27 +0530)
committerAyush Kumar Mishra <ayush.k.mishra@xcelenergy.com>
Tue, 9 Jun 2020 03:19:05 +0000 (08:49 +0530)
Fixed failing test-cases

Remove noisy suggestion of hash_map #72642

Fixed failing test-cases

src/librustc_resolve/diagnostics.rs
src/test/ui/derived-errors/issue-31997-1.stderr
src/test/ui/hygiene/no_implicit_prelude.stderr
src/test/ui/issues/issue-17546.stderr
src/test/ui/no-implicit-prelude-nested.stderr
src/test/ui/no-implicit-prelude.stderr
src/test/ui/resolve/use_suggestion.stderr
src/test/ui/resolve/use_suggestion_placement.stderr

index cbb2878011c5f2741e4fc206c421d6ea4cba901d..59fadfc41b06eb3461daf07442eb68b8239916dc 100644 (file)
@@ -680,7 +680,9 @@ fn lookup_import_candidates_from_module<FilterFn>(
                                 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 });
+                            }
                         }
                     }
                 }
index a4daf86cc8a211145cf2daf26a2fbb3e0513b58d..229c5c9e80ff8107b025ec0d993100af9673deb3 100644 (file)
@@ -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
 
index c0539434d02073e43920490c63404573a6a50122..990210ffb6b49b80a7395abc5668f851cfa676ba 100644 (file)
@@ -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;
    |
index 8bf40790f0b2492995d67acd2e9800899dba25ed..95939cf6b3840763eb7222ad818733a8344a820c 100644 (file)
@@ -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
index 8a26366d751d334e9886d796825b7ae860031f40..198b630c52c8fd96615f367970256fd3bc6896e3 100644 (file)
@@ -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
 
index 9cda4f64c79d0adfa8dd1eb2162ab556e6483adf..36a9b65b7d1613d3d3ea683a197e226cac0dc4a0 100644 (file)
@@ -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
 
index 2fd3d5dccd23d16b17bf0d522b25ea7c2b3eb94f..72dda94072962492f7f6f0322b96c99833e48f44 100644 (file)
@@ -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
index 9c337f515adbcd7eade90ff0d9d663ca1a7a9f37..3f91760fe216b59c37beccfcd3a12df8f425e8e3 100644 (file)
@@ -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