rust-osdev / uefi-rs

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

CI failing due to dead_code warnings on nightly #1205

Open nicholasbishop opened 1 week ago

nicholasbishop commented 1 week ago

See https://github.com/rust-osdev/uefi-rs/actions/runs/9508727436/job/26210548798 for example:

error: struct `GraphicsOutput` is never constructed
  --> uefi/src/proto/console/gop.rs:74:12
   |
74 | pub struct GraphicsOutput(GraphicsOutputProtocol);
   |            ^^^^^^^^^^^^^^
   |
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
[... many more warnings like this...]

I believe this is the same issue as https://github.com/rust-lang/rust/issues/126169.

Since this will likely affect a lot of projects, my guess is the change will eventually be reverted or made less strict (e.g. skipped for repr(C)/repr(transparent) types). So for now I think the best solution is to silence that warning for the nightly jobs.

Per https://doc.rust-lang.org/rustc/lints/levels.html, it should be possible to override the warning by appending -A dead-code. However, I tested RUSTFLAGS="-D warnings -A dead-code" cargo +nightly build -p uefi locally and still see all the same warnings. So for now I'll put up a PR that just sets an empty RUSTFLAGS for the nightly jobs (instead of our usual default of -D warnings.

nicholasbishop commented 1 week ago

https://github.com/rust-osdev/uefi-rs/pull/1206 is up with the temporary fix. I'll keep this bug open until the lint issue is properly resolved, either with rustc changes or uefi-rs changes.