Skip to content

Tracking Issue for const RangeBounds and const RangeX::contains #108082

@onestacked

Description

@onestacked
Contributor

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

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
on Feb 15, 2023
added a commit that references this issue on Feb 16, 2023
323e5e8
added
S-tracking-blockedStatus: This tracking issue is blocked on another tracking issue
on Mar 7, 2024
RalfJung

RalfJung commented on Sep 8, 2024

@RalfJung
Member

This got mostly removed by #110393, there's just one method left... is that even worth keeping?

RalfJung

RalfJung commented on Sep 8, 2024

@RalfJung
Member
reopened this on Sep 8, 2024
herabit

herabit commented on May 19, 2025

@herabit

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]`S-tracking-blockedStatus: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @RalfJung@oli-obk@onestacked@fee1-dead@Dylan-DPC

        Issue actions

          Tracking Issue for const `RangeBounds` and const `RangeX::contains` · Issue #108082 · rust-lang/rust