-
Notifications
You must be signed in to change notification settings - Fork 29
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
Use stablilized addr_of macro #50
Conversation
Thanks for the PR! I'm afraid this won't work, as CI shows, since the crate has to keep working with older versions of rustc. We'll have to do something similar to |
@RalfJung Thanks. I saw the problem and was struggling to find a solution. Your suggestion is very helpful, Let me look into it and send an updated version. |
README.md
Outdated
`memoffset` can make use of that feature to avoid what is technically Undefined Behavior. | ||
Use the `unstable_raw` feature to enable this. | ||
Since Rust 1.51.0, [a way to create raw pointers](https://github.com/rust-lang/rust/issues/73394) that avoids creating intermediate safe references | ||
has been stablilized, now `memoffset` makes use of that feature to avoid what is technically Undefined Behavior. |
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.
I think you can just remove this part of the readme; this is an internal cfg
flag now.
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.
Done ;-)
Since Rust 1.51.0, support for macro addr_of! has been stabilized[1], and this provides a way to get a raw pointer without potential UB in some cases. Memoffset alreadly uses the feature at the pre-stablilized stage (the macro was named as raw_const! then). Therefore, switch to use the stablilized version (and name) if Rust 1.51.0 and above is used, otherwise use the original fallback version, which works in a less technically correct way. [1]: rust-lang/rust#72279 Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Awesome, thanks a lot. :) |
@Gilnaa might be a good idea to make a new release with this MR when Rust 1.51 comes out. :) |
Sure :) |
Filed an issue for it: #51 |
Since Rust 1.51.0, support for macro addr_of!() has been stabilized1,
and this provides a way to get a raw pointer without potential UB in
some cases.
Memoffset alreadly uses the feature at the pre-stablilized stage (the
macro was named as raw_const then). Therefore, switch to use the
stablilized version (and name) and remove the out-dated version, also
remove the related feature gate.
Signed-off-by: Boqun Feng boqun.feng@gmail.com