News for hackers. Stuff that matters.
Re:Rust in QEMU Roadmap by bonzini on Tuesday December 03, 2024 @11:14AM (#42307765)
"Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should." :D

Though I admit that Rust also has to include the full list of base classes (https://github.com/rust-lang/rfcs/pull/1268 would fix it).

Re:Rust in QEMU Roadmap by o11c on Tuesday December 03, 2024 @03:15PM (#42310786)
The main reason the C version must hard-code is because C macros can't be recursive. What's Rust's excuse?

(that said, the C approach is also nice for manually accessing fields of distant base classes)

Re:Rust in QEMU Roadmap by bonzini on Wednesday December 04, 2024 @12:56AM (#42314808)
In Rust's case it is that when you say "you have IsA<Device> for all types that implement IsA<PCIDevice>" you are actually saying "you have IsA<Device> for all types, but only if they implement IsA<PCIDevice>".

When you later say "you have IsA<Device> for all types, but only if they implement IsA<I2CDevice>" the two conditions conflict.

It might be possible to avoid this issue with a different implementation but this is the simplest one that works and QEMU's hierarchy is generally shallow. If a better implementation came along, it would be a matter of search and repeat.