rust-vmm / vm-memory

Virtual machine's guest memory crate
Apache License 2.0
305 stars 98 forks source link

Improve unsafe code #212

Closed andreeaflorescu closed 1 year ago

andreeaflorescu commented 1 year ago

Summary of the PR

Requirements

Before submitting your PR, please make sure you addressed the following requirements:

andreeaflorescu commented 1 year ago

Why can't we use #[must_use] ?

The must_use will apply to the Result, and Result is already must_use in Rust. I couldn't find any way to specify that the inner type in a Result is a must_use. The only alternative that I could think of is changing the return type to a custom result type, but that comes with a breaking change and I didn't find it to be worth it. Do you know about an alternative to this? I might be missing something.