-
Notifications
You must be signed in to change notification settings - Fork 16
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
StableDeref is unsound for &T
#10
Comments
It sounds like you can supply a custom DerefMut impl for &T. Is that correct? |
Yes. |
That's unfortunate. What do you suggest? It seems like a fundamental assumption of owning_ref style crates is being violated, but there's no good way to fix it. Of course, there's already unsoundness due to noalias, but this might be easier to trigger. |
Honestly, I have no idea. There are two ways to go about it, but they are all to certain extent breaking changes.
And there is a third way which isn't strictly speaking breaking, but is more complicated:
Waiting for standard library to fix the issue in |
I'll hope for the third option for now. Option one or two risk breaking downstream users of owning_ref, etc. |
For reference, this was fixed in Rust 1.45 here: https://github.com/rust-lang/rust/pull/68004/files#diff-00dbb2b0acb6b28a9dd6f1a9d31bf41095ad6da2b9fa2e322425db7bae31b2f1 |
The following code violates
StableDeref
requirements.The text was updated successfully, but these errors were encountered: