rust-osdev / uefi-rs

Rust wrapper for UEFI.
https://rust-osdev.com/uefi-book
Mozilla Public License 2.0
1.23k stars 154 forks source link

`std(in|out|err)` methods can create multiple mutable references to the same object #239

Closed toku-sa-n closed 3 years ago

toku-sa-n commented 3 years ago

https://github.com/rust-osdev/uefi-rs/blob/a13ddfedf6532dcd7847fba187b1f64f1311967b/src/table/system.rs#L79-L93

I tried to change &self to &mut self, but it was difficult to fix the test codes.

https://github.com/rust-osdev/uefi-rs/blob/a13ddfedf6532dcd7847fba187b1f64f1311967b/uefi-test-runner/src/proto/mod.rs#L5-L17

Here, boot_services() takes an immutable reference to SystemTable while console::test has to take a mutable reference to SystemTable. This causes the conflict of the mutability of references.

GabrielMajeri commented 3 years ago

@toku-sa-n I've opened https://github.com/rust-osdev/uefi-rs/pull/240 to attempt to fix this. Does it provide a reasonable solution to prevent multiple mutable references?