Skip to content

Commit dde0567

Browse files
authored
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 90a2326 + cc7093f commit dde0567

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/core/src/error.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,19 @@ 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() {
1014+
(1, None)
1015+
} else {
1016+
(0, Some(0))
1017+
}
1018+
}
10111019
}
10121020

1021+
#[unstable(feature = "error_iter", issue = "58520")]
1022+
impl<'a> crate::iter::FusedIterator for Source<'a> {}
1023+
10131024
#[stable(feature = "error_by_ref", since = "1.51.0")]
10141025
impl<'a, T: Error + ?Sized> Error for &'a T {
10151026
#[allow(deprecated, deprecated_in_future)]

0 commit comments

Comments
 (0)