-
Notifications
You must be signed in to change notification settings - Fork 32
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
remove mut on split_ref function #43
base: master
Are you sure you want to change the base?
Conversation
I'll try to fix the CI |
Thank you for your PR! But It's unsafe to implement But the problem is to get mutable reference to static variable. Rust cannot ensure that you does this only once, so it's considered unsafe. So you need to either unsafely get mutable reference to |
Also I see that you are using |
Thanks for the excellent explanation, that definitely makes sense. Concerning I now found a cleaner solution for RTIC specifically: Instead of splitting the I am wondering how In any case, my issue is solved and this can be closed :) |
I don't know if this can be problematic I actually received this warning in clippy on the most recent stable compiler in my embedded project:
What I am doing is basically defining a
StaticRb
like this in my RTIC based application:and then splitting it like this
to pass the handles to different RTIC tasks. I need the unsafe because the RINGBUF has to be defined as a
static mut
.When I received the
mut
bound from thesplit_ref
function, I can use a regularstatic
and I can still split the static structure.