Rollup merge of #56760 - estebank:dedup-bounds, r=oli-obk
Deduplicate unsatisfied trait bounds Fix #35677.
This commit is contained in:
commit
e433da7ea0
@ -424,10 +424,12 @@ macro_rules! report_function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !unsatisfied_predicates.is_empty() {
|
if !unsatisfied_predicates.is_empty() {
|
||||||
let bound_list = unsatisfied_predicates.iter()
|
let mut bound_list = unsatisfied_predicates.iter()
|
||||||
.map(|p| format!("`{} : {}`", p.self_ty(), p))
|
.map(|p| format!("`{} : {}`", p.self_ty(), p))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>();
|
||||||
.join("\n");
|
bound_list.sort();
|
||||||
|
bound_list.dedup(); // #35677
|
||||||
|
let bound_list = bound_list.join("\n");
|
||||||
err.note(&format!("the method `{}` exists but the following trait bounds \
|
err.note(&format!("the method `{}` exists but the following trait bounds \
|
||||||
were not satisfied:\n{}",
|
were not satisfied:\n{}",
|
||||||
item_name,
|
item_name,
|
||||||
|
@ -14,8 +14,8 @@ LL | .collect(); //~ ERROR no method named `collect`
|
|||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the method `collect` exists but the following trait bounds were not satisfied:
|
= note: the method `collect` exists but the following trait bounds were not satisfied:
|
||||||
`std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
|
|
||||||
`&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
|
`&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
|
||||||
|
`std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
5
src/test/ui/issues/issue-35677.rs
Normal file
5
src/test/ui/issues/issue-35677.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
|
||||||
|
this.drain()
|
||||||
|
//~^ ERROR no method named
|
||||||
|
}
|
18
src/test/ui/issues/issue-35677.stderr
Normal file
18
src/test/ui/issues/issue-35677.stderr
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
error[E0601]: `main` function not found in crate `issue_35677`
|
||||||
|
|
|
||||||
|
= note: consider adding a `main` function to `$DIR/issue-35677.rs`
|
||||||
|
|
||||||
|
error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
|
||||||
|
--> $DIR/issue-35677.rs:3:10
|
||||||
|
|
|
||||||
|
LL | this.drain()
|
||||||
|
| ^^^^^
|
||||||
|
|
|
||||||
|
= note: the method `drain` exists but the following trait bounds were not satisfied:
|
||||||
|
`K : std::cmp::Eq`
|
||||||
|
`K : std::hash::Hash`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Some errors occurred: E0599, E0601.
|
||||||
|
For more information about an error, try `rustc --explain E0599`.
|
@ -5,8 +5,8 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
|
|||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: the method `count` exists but the following trait bounds were not satisfied:
|
= note: the method `count` exists but the following trait bounds were not satisfied:
|
||||||
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
|
|
||||||
`&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
|
`&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
|
||||||
|
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator`
|
||||||
|
|
||||||
error[E0631]: type mismatch in closure arguments
|
error[E0631]: type mismatch in closure arguments
|
||||||
--> $DIR/issue-36053-2.rs:17:32
|
--> $DIR/issue-36053-2.rs:17:32
|
||||||
|
Loading…
Reference in New Issue
Block a user