Restore error messaging

This commit is contained in:
Michael Goulet 2024-03-26 13:35:13 -04:00
parent 9d4f1d8b7e
commit 93c6c0445d
4 changed files with 17 additions and 8 deletions

View File

@ -1465,6 +1465,17 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
ocx.register_obligation(obligation);
} else {
result = ProbeResult::NoMatch;
if let Ok(Some(candidate)) = self.select_trait_candidate(trait_ref) {
for nested_obligation in candidate.nested_obligations() {
if !self.infcx.predicate_may_hold(&nested_obligation) {
possibly_unsatisfied_predicates.push((
self.resolve_vars_if_possible(nested_obligation.predicate),
Some(self.resolve_vars_if_possible(obligation.predicate)),
Some(nested_obligation.cause),
));
}
}
}
}
trait_predicate = Some(ty::Binder::dummy(trait_ref).to_predicate(self.tcx));

View File

@ -21,16 +21,14 @@ error[E0599]: the method `count` exists for struct `Filter<Fuse<Once<&str>>, {cl
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
| --------- ^^^^^ method cannot be called due to unsatisfied trait bounds
| |
| doesn't satisfy `_: FnMut<(&&str,)>` or `_: FnOnce<(&&str,)>`
| doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool` or `_: FnMut<(&&str,)>`
|
= note: the following trait bounds were not satisfied:
`{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnMut<(&&str,)>`
which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
`{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnOnce<(&&str,)>`
`<{closure@$DIR/issue-36053-2.rs:7:39: 7:48} as FnOnce<(&&str,)>>::Output = bool`
which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
`{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnMut<(&&str,)>`
which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
`{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnOnce<(&&str,)>`
which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
`Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
error: aborting due to 2 previous errors

View File

@ -70,7 +70,7 @@ LL | x.cmp(&x);
which is required by `Box<dyn T>: Iterator`
`dyn T: Ord`
which is required by `Box<dyn T>: Ord`
`dyn T: Iterator`
`Box<dyn T>: Iterator`
which is required by `&mut Box<dyn T>: Iterator`
`dyn T: Iterator`
which is required by `&mut dyn T: Iterator`

View File

@ -39,7 +39,7 @@ LL | | .collect();
= note: the following trait bounds were not satisfied:
`<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_`
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
`<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_`
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
error: aborting due to 2 previous errors