nix icon indicating copy to clipboard operation
nix copied to clipboard

refactor recvmmsg lifetimes

Open pacak opened this issue 9 months ago • 0 comments
trafficstars

What does this PR do

Currently recvmmsg uses a single lifetime to represent several different things:

  • preallocated MultiHdr
  • separately allocated IoSliceMut
  • iterator used to give access to all the IoSliceMut

While correct this makes it impossible to reuse preallocated headers in a loop - modified test fails to compile without this change, but compiles and runs as expected after.

As for the actual reason - I suspect this is a bug in the borrow checker, at least this RUSTFLAGS=-Zpolonius cargo +nightly check find no problems with modified test without requiring changes to recvmmsg.

Hmm... And there's an unrelated formatting only commit - current formatting is wrong, but ignored by CI.

Checklist:

  • [x] I have read CONTRIBUTING.md
  • [x] I have written necessary tests and rustdoc comments
  • [ ] A change log has been added if this PR modifies nix's API

pacak avatar Feb 10 '25 17:02 pacak