-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
UB inside Weak::as_ptr
#80365
Comments
I think it should only be UB to dereference the pointer you get from |
Because that pointer is being turned into a reference to feed to |
Looks like #73845 fixed this for |
Yes, seems this needs to use |
I renamed the issue to reflect that the bug is actually in |
Cc @CAD97 |
Assuming you use the default flags for Miri, that change should not be required to make Miri pass, so I'd be surprised if doing the same change for |
Ah, but the Miri ensures that references are at least dereferencable, so yeah that would explain the problem here. Good catch! |
Use raw version of align_of in rc data_offset This was missed in rust-lang#73845 when switching to use the raw operators. Fixes rust-lang#80365
Hm, Miri still complains, even after the fix landed... it seems Miri doesn't like |
IIRC, when I added |
Miri: make size/align_of_val work for dangling raw ptrs This is needed for rust-lang#80365 (comment). r? `@oli-obk`
Patch arrived really fast, we are assigning "post-mortem" a priority of |
I tried this code:
When I run it under
miri
, I get this:Creating a reference from such pointer looks suspicious indeed. I could send a pull request that adds a condition there, but I want to ask first if this is being done because „we are
std
, we can“, or if this is something that really should be fixed.Meta
rustc --version --verbose
:(but I've looked at the git sources and the thing is still there)
The text was updated successfully, but these errors were encountered: