Skip to content

Stabilize core::range::{legacy, RangeFull, RangeTo}#156629

Open
tgross35 wants to merge 2 commits into
rust-lang:mainfrom
tgross35:range-module-stabilizations
Open

Stabilize core::range::{legacy, RangeFull, RangeTo}#156629
tgross35 wants to merge 2 commits into
rust-lang:mainfrom
tgross35:range-module-stabilizations

Conversation

@tgross35
Copy link
Copy Markdown
Contributor

Stabilize core::range::legacy and the re-exports of unchanged range types, so all range types can now be imported from within core::range. Newly stable API:

use core::range::RangeFull;
use core::range::RangeTo;
use core::range::legacy::{Range, RangeFrom, RangeInclusive, RangeToInclusive};

Compared to what is in the comment, I made a few exclusions:

  1. At Tracking Issue for new_range_api (part of RFC 3550) #125687 (comment), @sendittothenewts suggested not to stabilize core::range::RangeBounds in case we want to reuse that name for a replacement based on IntoBounds. I have excluded it here so we can discuss further. range_into_bounds tracking issue: Tracking Issue for range_into_bounds #136903
  2. one_sided_range types should probably just move into this module rather than being exported, since they are unstable. Added an unresolved question at Tracking Issue for OneSidedRange #69780.
  3. Similarly, step_trait is unstable so we could just move crate::iter::Step if core::range is a better home. Added an unresolved question at Tracking issue for step_trait stabilization #42168.

Since this is the last thing in new_range_api that isn't tracked elsewhere:

Closes: #125687

Cc @pitaj

Newly stable API:

    core::range::legacy
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 15, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 15, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 17 candidates

@tgross35
Copy link
Copy Markdown
Contributor Author

r? libs

This API isn't covered by the FCP on the tracking issue:

@rustbot label +I-libs-api-nominated

@rustbot rustbot added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label May 15, 2026
@tgross35 tgross35 added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label May 15, 2026
@rust-log-analyzer

This comment has been minimized.

Stabilized under `new_range_api_exports`. Newly stable API:

    core::range::RangeFull;
    core::range::RangeTo;
@tgross35 tgross35 force-pushed the range-module-stabilizations branch from 66c5493 to 8d9f3da Compare May 15, 2026 23:36
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-04-14/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
To only update this specific test, also pass `--test-args did_you_mean/sugg-stable-import-first-issue-140240.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/did_you_mean/sugg-stable-import-first-issue-140240.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/did_you_mean/sugg-stable-import-first-issue-140240" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find type `Range` in this scope
##[error]  --> /checkout/tests/ui/did_you_mean/sugg-stable-import-first-issue-140240.rs:3:14
   |
LL |     const _: Range = 0..1; //~ ERROR cannot find type `Range` in this scope
   |              ^^^^^ not found in this scope
   |
help: consider importing one of these structs
   |
LL + use std::collections::btree_map::Range;

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

Labels

I-libs-api-nominated Nominated for discussion during a libs-api team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for new_range_api (part of RFC 3550)

5 participants