Stabilize funnel_shifts (including const) - #161015
Conversation
|
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr
cc @rust-lang/wg-const-eval
cc @rust-lang/wg-const-eval
cc @rust-lang/miri
cc @Amanieu, @folkertdev, @sayantn |
| #[rustc_intrinsic_const_stable_indirect] | ||
| #[rustc_intrinsic] | ||
| #[rustc_nounwind] | ||
| #[rustc_const_unstable(feature = "funnel_shifts", issue = "145686")] | ||
| #[unstable(feature = "funnel_shifts", issue = "145686")] | ||
| #[track_caller] | ||
| #[rustc_allow_const_fn_unstable(const_trait_impl, core_intrinsics_fallbacks)] | ||
| #[miri::intrinsic_fallback_is_spec] | ||
| pub const unsafe fn unchecked_funnel_shl<T: [const] fallback::FunnelShift>( |
There was a problem hiding this comment.
Note that const_trait_impl is only needed for the fallback. We could implement a version without it if needed.
The fallback traits are gated behind core_intrinsics_fallbacks, I'm not sure whether there's a cleaner way to do this.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
cf9c57e to
11cd98d
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
`funnel_shl` and `funnel_shr` have been around for close to a year, the
unchecked versions for a number of months. These are reasonably small
and uncontroversial, and it can be tricky to get similar performance
with a fallback; stabilize them here.
Newly stable API:
impl {u8, u16, u32, u64, u128, usize} {
pub const fn funnel_shl(self, right: Self, shift: u32) -> Self;
pub const fn funnel_shr(self, right: Self, shift: u32) -> Self;
pub const unsafe fn unchecked_funnel_shl(self, right: Self, shift: u32) -> Self;
pub const unsafe fn unchecked_funnel_shr(self, right: Self, shift: u32) -> Self;
}
The tracking issue also mentions a `wrapping_` version but it has not
been implemented.
Tracking issue: RUST-145686
11cd98d to
c21507f
Compare
funnel_shlandfunnel_shrhave been around for close to a year, the unchecked versions for a number of months. These are reasonably small and uncontroversial, and it can be tricky to get similar performance with a fallback; stabilize them here.Newly stable API:
The tracking issue also mentions a
wrapping_version but it has not been implemented.Closes: #145686 (tracking issue, wrapping versions will need a new issue)
This involves an intrinsic stabilization so needs FCP from both @rust-lang/lang and @rust-lang/libs-api.
@rustbot label +I-lang-nominated +I-libs-api-nominated
Cc others who have been involved: @RalfJung, @folkertdev, @sayantn
r? libs