-
Notifications
You must be signed in to change notification settings - Fork 13k
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
ptr-ptr cast does not work well with lifetimes (lifetime widening) #27214
Comments
Why would this cast work? |
Raw pointer casts are normally not restricted. |
Ah, I see, thanks @bluss . Seems reasonable. |
Does Rust guarantee that pointers are correctly aligned? Would it be legal in a safe context to create a misaligned pointer? |
Currently, loads and writes through raw pointer dereferences assume the pointer is aligned (this is guarded by
For guarantees, have to ask https://internals.rust-lang.org/c/language-design/unsafe-code-guidelines |
As @talchas on fn foo<'a>(v: *const &'a ()) {
let v: *const &'static () = v as *const () as *const &'static ();
} |
Triage: still reproduces. |
Triage: No longer reproduces (fail→pass). We could just close this as completed but I'm actually not sure which PR(s) was responsible. Might try to bisect later. |
STR
Expected result
cast will be successful
Actual Result
The text was updated successfully, but these errors were encountered: