()
| 37 | } |
| 38 | |
| 39 | fn error_retry_closure() { |
| 40 | use rustix::buffer::Buffer; |
| 41 | use rustix::io; |
| 42 | use rustix::io::retry_on_intr; |
| 43 | |
| 44 | fn b<B: Buffer<u8>>(b: B) -> io::Result<B::Output> { |
| 45 | unsafe { Ok(b.assume_init(0)) } |
| 46 | } |
| 47 | |
| 48 | let mut event_buf = [0; 4]; |
| 49 | |
| 50 | // Ideally we'd write this, but it gets: |
| 51 | // "cannot move out of `event_buf`, a captured variable in an `FnMut` closure". |
| 52 | /* |
| 53 | let event_buf_slice = event_buf.as_mut_slice(); |
| 54 | retry_on_intr(|| b(event_buf_slice)).unwrap(); |
| 55 | */ |
| 56 | |
| 57 | // The fix: Add `&mut *`. |
| 58 | let event_buf_slice = event_buf.as_mut_slice(); |
| 59 | retry_on_intr(|| b(&mut *event_buf_slice)).unwrap(); |
| 60 | } |
| 61 | |
| 62 | fn error_retry_closure_uninit() { |
| 63 | use rustix::buffer::Buffer; |
no test coverage detected