-
Notifications
You must be signed in to change notification settings - Fork 190
Discourage use of static mut in singleton #389
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
Comments
"error: creating a mutable reference to mutable static is discouraged"? Yeah, we should stick |
I'm a beginner myself and not sure about the best practice. Would using static (without mut) followed by &raw mut better? I think this is the preferrable syntax and also gives opportunity to explain. Other would be UnsafeCell or UnsafeSyncCell. I could try opening a PR and maybe others can point out if my understanding is sound or not |
Honestly, there's nothing wrong with the code as it stands as far as I know. That said, those other possibilities are there too. Feel free to post some code either in a PR or just attach it here and we'll be happy to look at it. |
Pushed #390 just now. Any feedback would be appreciated. |
The code in this part about Singleton no longer works as of Rust 2024
https://docs.rust-embedded.org/book/peripherals/singletons.html
giving error instead of warning "mutable reference to mutable static"
The text was updated successfully, but these errors were encountered: