-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn
#11861
bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn
#11861
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work :) And yeah, great idea to split this out.
Waiting for James to take a look before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is a step in the right direction given how dense some of the unsafe code is in bevy_ecs. However, I lament how it impacts end-to-end readabilty though given that some of these functions are nothing but unsafe, all the way through.
cargo geiger
is going to explode on bevy_ecs
from this PR though.
Co-authored-by: James Liu <contact@jamessliu.com>
Co-authored-by: James Liu <contact@jamessliu.com>
Co-authored-by: James Liu <contact@jamessliu.com>
unsafe block is a syntactic salt to force the developer to be more careful when making changes to unsafe code. Since it is a human's responsibility to ensure the safety rules, IMHO, it's worth it to pay the cost of readability in exchange for having a well-documented code. |
…e#11861) # Objective - Part of bevyengine#11590 - Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs ## Solution Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an `unsafe` block when the safety comment already exists or add a comment like "The invariants are uphold by the caller". --------- Co-authored-by: James Liu <contact@jamessliu.com>
…e#11861) # Objective - Part of bevyengine#11590 - Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs ## Solution Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an `unsafe` block when the safety comment already exists or add a comment like "The invariants are uphold by the caller". --------- Co-authored-by: James Liu <contact@jamessliu.com>
…e#11861) # Objective - Part of bevyengine#11590 - Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs ## Solution Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an `unsafe` block when the safety comment already exists or add a comment like "The invariants are uphold by the caller". --------- Co-authored-by: James Liu <contact@jamessliu.com>
…e#11861) - Part of bevyengine#11590 - Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an `unsafe` block when the safety comment already exists or add a comment like "The invariants are uphold by the caller". --------- Co-authored-by: James Liu <contact@jamessliu.com>
Objective
unsafe_op_in_unsafe_fn
lint #11590unsafe_op_in_unsafe_fn
for trivial cases in bevy_ecsSolution
Fix
unsafe_op_in_unsafe_fn
in bevy_ecs for trivial cases, i.e., add anunsafe
block when the safety comment already exists or add a comment like "The invariants are uphold by the caller".