Fix pointer API to match what was stabilized#526
Conversation
| // FIXME(strict_provenance_magic): this should be backed by a dedicated SIMD intrinsic, | ||
| // but currently that path can ICE on some nightly toolchains. | ||
| // SAFETY: Integer-to-pointer transmutes are valid and model pointer-int-pointer casts. | ||
| unsafe { core::mem::transmute_copy(&addr) } |
There was a problem hiding this comment.
is there an issue for the ICEs?
saying integer to pointer transmutes are valid seems to contradict the comments in without_provenance above, as well as the docs in latest nightly: https://github.com/rust-lang/rust/blob/63b1dfc0e00fd6f8ad7cd8817fc712e7d9b7be59/library/core/src/ptr/mod.rs#L942-L946
There was a problem hiding this comment.
It also contradicts the stable docs of transmute: https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers
I think that means we'll have to wait until the intrinsic is working properly.
There was a problem hiding this comment.
Whoops, that was an outdated comment from when I saw another problem. We were already using transmutes, but do you think we should use the scalar functions for now?
There was a problem hiding this comment.
yeah, using the scalar functions is at least correct.
There was a problem hiding this comment.
I confused myself, I had copy paste mistakes and thought we were talking about without_provenance. I fixed with_exposed_provenance and updated the comment on without_provenance to match std
bb0ef6c to
c4f3110
Compare
No description provided.