Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtic-usb-cdc-echo example generates warnings #747

Open
sre opened this issue Mar 9, 2024 · 0 comments
Open

rtic-usb-cdc-echo example generates warnings #747

sre opened this issue Mar 9, 2024 · 0 comments

Comments

@sre
Copy link

sre commented Mar 9, 2024

With latest Rust compiler, the USB example generates this warning:

    |             USB_BUS.replace(UsbBus::new(usb, &mut EP_MEMORY));
    |                                              ^^^^^^^^^^^^^^ mutable reference of mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
    = note: reference of mutable static is a hard error from 2024 edition
    = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
    |
    |             USB_BUS.replace(UsbBus::new(usb, addr_of_mut!(EP_MEMORY)));
    |                                              ~~~~~~~~~~~~~~~~~~~~~~~

warning: mutable reference of mutable static is discouraged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant