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
Gonna tackle making the rest of the relevant traits in core::ops const. Previously, I was going to split this into const_arith_ops and const_bit_ops, but per recommendation, I've un-split them, meaning that no split is going to happen.
EDIT: Will include a full list of changes in attached PR, but it's worth noting the relevant traits that will be added to this tracking issue:
Neg
Not
BitAnd
BitOr
BitXor
Shl
Shr
AddAssign
SubAssign
MulAssign
DivAssign
RemAssign
BitAndAssign
BitOrAssign
BitXorAssign
ShlAssign
ShrAssign
Additionally, besides the current implementations for primitives, it will include implementations for Duration, Ipv[46]Addr, references of primitives, Wrapping, and Saturating, since all of those implementations depend on already-const-stable methods and just needed to be marked const with the appropriate stability attribute.
In particular, I suspect that the Assign variants were omitted back when these traits were originally constified because mutable references weren't stable in const context yet, but they now are, so, there's no reason to not include them as well since most of them are just simple *self = *self op rhs impls anyway.
Previously, I was going to split this into const_arith_ops and const_bit_ops, but per recommendation, I've un-split them, meaning that no split is going to happen.
I don't think a split is necessary here. I think if we were to stablize it we'd likely stabilize them altogether.
Also highlighting @Zalathar's comment on #143949, which indicated that a perf regression showed up merging these changes: #145236 (comment)
This shouldn't affect perf, but since these operations on primitives were all const despite the traits not being implemented anyway, perhaps they're going through the traits now which is slower? I have absolutely no idea what the actual issue is here, but I figured that I'd share on the tracking issue since the PR is now merged.
Activity
Rollup merge of rust-lang#143803 - RalfJung:const-trait-tracking, r=c…
Rollup merge of rust-lang#143803 - RalfJung:const-trait-tracking, r=c…
Unrolled build for #143803
clarfonthey commentedon Jul 14, 2025
Gonna tackle making the rest of the relevant traits in
core::opsconst. Previously, I was going to split this intoconst_arith_opsandconst_bit_ops, but per recommendation, I've un-split them, meaning that no split is going to happen.EDIT: Will include a full list of changes in attached PR, but it's worth noting the relevant traits that will be added to this tracking issue:
NegNotBitAndBitOrBitXorShlShrAddAssignSubAssignMulAssignDivAssignRemAssignBitAndAssignBitOrAssignBitXorAssignShlAssignShrAssignAdditionally, besides the current implementations for primitives, it will include implementations for
Duration,Ipv[46]Addr, references of primitives,Wrapping, andSaturating, since all of those implementations depend on already-const-stable methods and just needed to be marked const with the appropriate stability attribute.In particular, I suspect that the
Assignvariants were omitted back when these traits were originally constified because mutable references weren't stable in const context yet, but they now are, so, there's no reason to not include them as well since most of them are just simple*self = *self op rhsimpls anyway.fee1-dead commentedon Jul 20, 2025
I don't think a split is necessary here. I think if we were to stablize it we'd likely stabilize them altogether.
Rollup merge of rust-lang#143803 - RalfJung:const-trait-tracking, r=c…
Rollup merge of rust-lang#143949 - clarfonthey:const-arith-ops, r=Ama…
Rollup merge of rust-lang#143949 - clarfonthey:const-arith-ops, r=Ama…
Rollup merge of rust-lang#143949 - clarfonthey:const-arith-ops, r=Ama…
clarfonthey commentedon Aug 11, 2025
#143949 is now merged, so, the issue description needs to be updated. Full list of changes is in the PR description.
Unrolled build for #143949
clarfonthey commentedon Aug 12, 2025
Also highlighting @Zalathar's comment on #143949, which indicated that a perf regression showed up merging these changes: #145236 (comment)
This shouldn't affect perf, but since these operations on primitives were all const despite the traits not being implemented anyway, perhaps they're going through the traits now which is slower? I have absolutely no idea what the actual issue is here, but I figured that I'd share on the tracking issue since the PR is now merged.
Rollup merge of rust-lang#143949 - clarfonthey:const-arith-ops, r=Ama…
rustbot commentedon Aug 29, 2025
Error: Label since can only be set by Rust team members
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.
scimind2460 commentedon Sep 13, 2025
Since @clarfonthey has made the PR for the remaining
impls (#143949), can't we check this off?