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
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 <[email protected]>
Copy file name to clipboardExpand all lines: README.md
-5
Original file line number
Diff line number
Diff line change
@@ -73,8 +73,3 @@ Your crate root: (`lib.rs`/`main.rs`)
73
73
```
74
74
75
75
If you intend to use `offset_of!` inside a `const fn`, also add the `const_fn` compiler feature.
76
-
77
-
### Raw references ###
78
-
Recent nightlies support [a way to create raw pointers](https://github.com/rust-lang/rust/issues/73394) that avoids creating intermediate safe references.
79
-
`memoffset` can make use of that feature to avoid what is technically Undefined Behavior.
0 commit comments