-
Notifications
You must be signed in to change notification settings - Fork 434
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
Why does RxToken require a &mut [u8] as the argument? #443
Comments
It was added in case the internals of smoltcp might want to modify the incoming packet, which is usually exclusive to the TCP/IP stack due to how networking hardware is accessed. We can probably downgrade it to |
I transmuted the reference to mut, and it works just fine in this case. |
If it's not used mutably by smoltcp it will work currently. It's just dangerous because it may break, when smoltcp decides to mutate it some day. So it would probably be better to change it to I started working on a smoltcp device implementation recently too and think this would be easier to implement safely if it were not mutable. |
I think this might be unsound. |
I'm fully aware of the unsoundness, but I have to get my job done anyway. If the code break, I can review all unsafe code then |
I only got &[u8] somewhere, and find that RxToken requires a &mut [u8]. I can't see any use case of &mut u8. Is it for future-proof or something else?
The text was updated successfully, but these errors were encountered: