You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first off I want to thank you for this library. It's made my life so much easier.
There are definitely ways to cause UB in safe Rust with this library. The main one I ran into today was needing to call is_valid before calling any other methods on some types.
I think it would be more "rust-y" if maybe_wrap was the default and wrap was unsafe and only used when the check is too expensive for performance reasons and we already knew it was valid for another reason. This would mean if I had a SBFoo I'd know it's already been checked for validity.
I'm not up for making this change to everything at once but I'm open to doing this for some types as I work on my own project, if that sounds useful to you?
The text was updated successfully, but these errors were encountered:
Hi, first off I want to thank you for this library. It's made my life so much easier.
There are definitely ways to cause UB in safe Rust with this library. The main one I ran into today was needing to call
is_valid
before calling any other methods on some types.I think it would be more "rust-y" if
maybe_wrap
was the default andwrap
was unsafe and only used when the check is too expensive for performance reasons and we already knew it was valid for another reason. This would mean if I had aSBFoo
I'd know it's already been checked for validity.I'm not up for making this change to everything at once but I'm open to doing this for some types as I work on my own project, if that sounds useful to you?
The text was updated successfully, but these errors were encountered: