-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`S-tracking-blockedStatus: This tracking issue is blocked on another tracking issueStatus: This tracking issue is blocked on another tracking issueT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(const_range_bounds)]
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.
Public API
// core::ops::RangeInclusive
impl<Idx> RangeInclusive<Idx> {
pub const fn into_inner(self) -> (Idx, Idx)
}
Steps / History
- Implementation: #...Wait for
#![feature(const_trait_impl)]
to become stable Tracking issue for closed RFC 2632,impl const Trait for Ty
and[const]
(conditionally const) syntax (const_trait_impl
) #67792Final comment period (FCP)1Stabilization PRTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Unresolved Questions
- None yet.
Footnotes
K4rakara and skrobchik
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`S-tracking-blockedStatus: This tracking issue is blocked on another tracking issueStatus: This tracking issue is blocked on another tracking issueT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
RangeBounds
,RangeX::contains
andRangeX::is_empty
(where applicable). #108084Rollup 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
RangeBounds
functionality throughconst
inherent 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 ofRangeBounds
in stable, that work inconst
, difficult.Even if
const
traits 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 byconst
traits, if they ever arrive.