Skip to content

Commit

Permalink
Rollup merge of #73023 - ayushmishra2005:remove_noisy_suggestion, r=d…
Browse files Browse the repository at this point in the history
…avidtwco

Remove noisy suggestion of hash_map

Remove noisy suggestion of hash_map #72642

fixes #72642
  • Loading branch information
Dylan-DPC authored Jun 10, 2020
2 parents 024f025 + b055552 commit e1cd8c4
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 70 deletions.
4 changes: 3 additions & 1 deletion src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/derived-errors/issue-31997-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/hygiene/no_implicit_prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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;
|
Expand Down
10 changes: 4 additions & 6 deletions src/test/ui/issues/issue-17546.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
48 changes: 12 additions & 36 deletions src/test/ui/no-implicit-prelude-nested.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,29 @@ 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
|
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
|
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;
|
Expand All @@ -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
Expand All @@ -84,35 +76,29 @@ 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
|
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
|
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;
|
Expand All @@ -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
Expand All @@ -153,35 +137,29 @@ 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
|
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
|
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;
|
Expand All @@ -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

Expand Down
16 changes: 4 additions & 12 deletions src/test/ui/no-implicit-prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,29 @@ 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
|
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
|
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;
|
Expand All @@ -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

Expand Down
8 changes: 2 additions & 6 deletions src/test/ui/resolve/use_suggestion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,21 @@ 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
|
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
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/resolve/use_suggestion_placement.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e1cd8c4

Please sign in to comment.