Hello, I've been thinking about https://github.com/rust-lang/miri/issues/1007 and I wanted to build a solution that allows to implement the
write shims for unix without having to write to intermediate buffers.
My first naive solution would be to do an
Allocation::get_mut wrapper inside
Memory that checks bounds just like
Memory::write_bytes does (of course this might end in an horrible way, I haven't thought about the implications)
As an alternative for
readI might be able to do something with the
Read::bytes method, but that consumes the file itself so... I don't have high hopes in that direction.
@RalfJ , @oli let me know what you think :)
My first naive solution would be to do an Allocation::get_mut wrapper inside
Memory that checks bounds just like Memory::write_bytes does
get_mut still has a subtle contract: the caller must actually write to all the
bytes in the given range.
I would say, for us to do optimizations that involve exposing subtle APIs like
that, I'd first like to see benchmarks demonstrating that this cost is worth the
(Just a quick reply via email; I'm too busy for Zulip for another week I'm afraid.)
Yes the subtle contract part was what I was worrying about
I'm going to go first for the correct way and then we can think about the fast way :P