Re: [PATCH v2 1/6] rust: io: turn IoCapable into a functional trait

Danilo Krummrich
2026-02-12T14:52:18Z

On Thu Feb 12, 2026 at 3:11 PM CET, Gary Guo wrote:
> They can, but the `Io` trait just passes the wrong address to the `IoCapable`
> trait, and nothing horrible can happen without doing things unsafely inside
> `IoCapable` impl, which is controlled by the user who implements `Io`. It looks
> to me that unsafe code is still needed to do bogus things.

I think what you mean is that the invariant of `addr` and `maxsize` being valid
is on the implementing type of `Io`, e.g. `MmioRaw` and `Mmio`. The same applies
to IoKnownSize::MIN_SIZE.

To me this seems like a valid way of arguing.