Skip to content

Conversation

@tamird
Copy link
Contributor

@tamird tamird commented Nov 26, 2025

In edition 2024 functions annotated with target_feature(enable = "..")
are unsafe to call from contexts not so annotated, and otherwise safe.

This was used in rust-lang/stdarch@59864cd to
mark RDRAND safe, and this change is expected to be in 1.93.0 and is
already in nightly. Since uefi targets are only tested on nightly, we
only saw this lint on uefi, resulting in a misattribution of the
behavior and an incorrect comment.

Thus acknowledge that the intrinsics are safe and mark rdrand itself
safe (when called from an annotated context) and remove all the newly
unused unsafe blocks.

Link: https://doc.rust-lang.org/reference/attributes/codegen.html#r-attributes.codegen.target_feature.safety-restrictions.

@tamird
Copy link
Contributor Author

tamird commented Nov 26, 2025

Oops, this is incorrect, it has to do with rust-lang/stdarch#1908. I'll update this PR in a moment.

@tamird tamird changed the title rdrand: remove unused unsafe rdrand: mark rdrand safe Nov 26, 2025
In edition 2024 functions annotated with `target_feature(enable = "..")`
are unsafe to call from contexts not so annotated, and otherwise safe.

This was used in rust-lang/stdarch@59864cd to
mark RDRAND safe, and this change is expected to be in 1.93.0 and is
already in nightly. Since uefi targets are only tested on nightly, we
only saw this lint on uefi, resulting in a misattribution of the
behavior and an incorrect comment.

Thus acknowledge that the intrinsics are safe and mark `rdrand` itself
safe (when called from an annotated context) and remove all the newly
unused unsafe blocks.

Link: https://doc.rust-lang.org/reference/attributes/codegen.html#r-attributes.codegen.target_feature.safety-restrictions.
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.

1 participant