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
{{ message }}
Repository navigation
Tracking Issue for const RangeBounds and const RangeX::contains #108082
This is a tracking issue for making RangeBounds#[const_trait], implementing it for all Range types and allowing range.contains() and associated functions to be called form a const context.
I think it would be useful to at the very least expose the RangeBounds functionality through const inherent methods, particularly on RangeInclusive.
Currently there is no way of checking whether the the end bound should be inclusive or exclusive in const, which makes for implementing accurate reimplementations of RangeBounds in stable, that work in const, difficult.
Even if const traits aren't available, ever, for types that can expose similar functionality to the traits the implement, in const, I think they probably should, and just deprecate those inherent methods when, or if they become superseded by const traits, if they ever arrive.
Activity
Rollup merge of rust-lang#108084 - ink-feather-org:const_range, r=dto…
RalfJung commentedon Sep 8, 2024
This got mostly removed by #110393, there's just one method left... is that even worth keeping?
RalfJung commentedon Sep 8, 2024
herabit commentedon May 19, 2025
I think it would be useful to at the very least expose the
RangeBoundsfunctionality throughconstinherent methods, particularly onRangeInclusive.Currently there is no way of checking whether the the end bound should be inclusive or exclusive in
const, which makes for implementing accurate reimplementations ofRangeBoundsin stable, that work inconst, difficult.Even if
consttraits aren't available, ever, for types that can expose similar functionality to the traits the implement, inconst, I think they probably should, and just deprecate those inherent methods when, or if they become superseded byconsttraits, if they ever arrive.