Skip to content

Fix pointer API to match what was stabilized#526

Merged
calebzulawski merged 1 commit into
masterfrom
update-pointer-api
May 9, 2026
Merged

Fix pointer API to match what was stabilized#526
calebzulawski merged 1 commit into
masterfrom
update-pointer-api

Conversation

@calebzulawski
Copy link
Copy Markdown
Member

No description provided.

Comment thread crates/core_simd/src/simd/ptr.rs Outdated
// 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) }
Copy link
Copy Markdown
Member

@programmerjake programmerjake May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, using the scalar functions is at least correct.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@calebzulawski calebzulawski merged commit 94a3ba2 into master May 9, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants