# Forgetting futures with borrowed data

**URL:** <https://internals.rust-lang.org/t/forgetting-futures-with-borrowed-data/10824>\
**Category:** language design\
**Created:** [August 19, 2019, 4:17am UTC](https://internals.rust-lang.org/t/forgetting-futures-with-borrowed-data/10824 "2019-08-19T04:17:03Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![cramertj](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cramertj](https://internals.rust-lang.org/u/cramertj)\
**Post date:** [August 19, 2019, 8:31pm UTC](https://internals.rust-lang.org/t/forgetting-futures-with-borrowed-data/10824/7 "2019-08-19T20:31:13Z")

</div>

It's true that the naiive version of this API which passes `&mut [u8]` to io\_uring or the like can't be made sound, since there's no guarantee that you'll be able to run code before the `[u8]` goes away. You can get around this, though, with something like a `Pin<&mut IoUringBuf>` where the underlying buffer is `!Unpin` and will deregister itself from the async read before deallocating memory. This is unfortunate in that you can't just use "normal" `&mut [u8]` like you'd ideally want, but it's definitely workable. I've spent a good amount of time thinking about this, and I don't think we could've done this any other way based on Rust's existing set of guarantees/non-guarantees.

---

_[View the full topic](https://internals.rust-lang.org/t/forgetting-futures-with-borrowed-data/10824)._
