(
&mut self,
mut f: impl FnMut(&mut Error) -> Option<&mut T>,
)
| 866 | |
| 867 | #[inline] |
| 868 | fn error_ext_chain_mut<T>( |
| 869 | &mut self, |
| 870 | mut f: impl FnMut(&mut Error) -> Option<&mut T>, |
| 871 | ) -> Option<&mut T> { |
| 872 | let mut cur = self; |
| 873 | loop { |
| 874 | { |
| 875 | // Safety: We are running into "problem case #3" of non-lexical |
| 876 | // lifetimes: we are returning a mutable reference, which must |
| 877 | // be live for the whole function's scope, but accessing it |
| 878 | // again below in `cur.inner.source_mut()`. This is safe because |
| 879 | // control flow ensures that the borrow is not actually active |
| 880 | // anymore in the case where we didn't return. |
| 881 | // |
| 882 | // https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md#problem-case-3-conditional-control-flow-across-functions |
| 883 | let cur = unsafe { NonNull::from(&mut *cur).as_mut() }; |
| 884 | if let Some(x) = f(cur) { |
| 885 | return Some(x); |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | cur = cur.inner.source_mut()?; |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | #[inline] |
| 894 | fn error_ext_zip<T>(mut self, mut f: impl FnMut(Error) -> Result<T, Error>) -> Result<T, Self> { |
no test coverage detected