coconut-svsm / svsm

COCONUT-SVSM
MIT License
122 stars 43 forks source link

kernel/gdbstub.rs: Allow mutable reference to mutable static #305

Closed cclaudio closed 8 months ago

cclaudio commented 8 months ago

The latest cargo release v1.77.0 is generating a warning for the "&mut PACKET_BUFFER", failing our github CI.

error: creating a mutable reference to mutable static is discouraged
  --> kernel/src/debug/gdbstub.rs:52:37
   |
52 |                 .with_packet_buffer(&mut PACKET_BUFFER)
   |                                     ^^^^^^^^^^^^^^^^^^ mutable reference to mutable static

Although it says that creating a mutable reference to mutable static is discouraged, this is the only place we use the PACKET_BUFFER variable and so it seems safe.

This PR overrides "-D warnings" by adding "#[allow(static_mut_refs)]". That will force us to update our installed cargo to latest, otherwise, an error message like "unknown lint" will be printed.

joergroedel commented 8 months ago

Okay, longer term we should probably move all of the global statics in the gdb-stub code into a separate struct. For now this fix is acceptable.