Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6f6e343

Browse files
authoredJul 10, 2024
Rollup merge of rust-lang#127091 - Sky9x:fused-error-sources-iter, r=dtolnay
impl FusedIterator and a size hint for the error sources iter cc tracking issue rust-lang#58520
2 parents c5f1c76 + e26c881 commit 6f6e343

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎core/src/error.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,15 @@ impl<'a> Iterator for Source<'a> {
10081008
self.current = self.current.and_then(Error::source);
10091009
current
10101010
}
1011+
1012+
fn size_hint(&self) -> (usize, Option<usize>) {
1013+
if self.current.is_some() { (1, None) } else { (0, Some(0)) }
1014+
}
10111015
}
10121016

1017+
#[unstable(feature = "error_iter", issue = "58520")]
1018+
impl<'a> crate::iter::FusedIterator for Source<'a> {}
1019+
10131020
#[stable(feature = "error_by_ref", since = "1.51.0")]
10141021
impl<'a, T: Error + ?Sized> Error for &'a T {
10151022
#[allow(deprecated, deprecated_in_future)]

0 commit comments

Comments
 (0)
Failed to load comments.