diff --git a/library/core/src/error.rs b/library/core/src/error.rs index 150e4f3f318..ca8983d4cbc 100644 --- a/library/core/src/error.rs +++ b/library/core/src/error.rs @@ -1008,8 +1008,15 @@ fn next(&mut self) -> Option { self.current = self.current.and_then(Error::source); current } + + fn size_hint(&self) -> (usize, Option) { + if self.current.is_some() { (1, None) } else { (0, Some(0)) } + } } +#[unstable(feature = "error_iter", issue = "58520")] +impl<'a> crate::iter::FusedIterator for Source<'a> {} + #[stable(feature = "error_by_ref", since = "1.51.0")] impl<'a, T: Error + ?Sized> Error for &'a T { #[allow(deprecated, deprecated_in_future)]