Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow IndexSlice to be indexed by ranges. #136610

Merged
merged 3 commits into from
Feb 24, 2025
Merged

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Feb 6, 2025

This comes with some annoyances as the index type can no longer inferred from indexing expressions. The biggest offender for this is IndexVec::from_fn_n(|idx| ..., n) where the index type won't be inferred from the call site or any index expressions inside the closure.

My main use case for this is mapping a Place to Range<Idx> for value tracking where the range represents all the values the place contains.

@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2025

r? @Noratrieb

rustbot has assigned @Noratrieb.
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

@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. labels Feb 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in coverage instrumentation.

cc @Zalathar

@oli-obk oli-obk added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 6, 2025
@oli-obk

This comment was marked as resolved.

@Jarcho Jarcho changed the title Allow SliceIndex to be indexed by ranges. Allow IndexSlice to be indexed by ranges. Feb 18, 2025
@Jarcho
Copy link
Contributor Author

Jarcho commented Feb 18, 2025

I just realized I had a typo in the title; should have been IndexSlice not SliceIndex. This is in rustc_index so not a libs-api concern.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 21, 2025

I think there are various improvements that could be landed on master first before this PR (or just as commits before the currently only commit of this PR)

@Jarcho Jarcho force-pushed the range_idx branch 2 times, most recently from bb61f03 to 8705084 Compare February 21, 2025 20:54
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Sky9x
Copy link
Contributor

Sky9x commented Feb 23, 2025

I just realized I had a typo in the title; should have been IndexSlice not SliceIndex. This is in rustc_index so not a libs-api concern.

@rustbot label -T-libs-api

:)

@rustbot rustbot removed the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 23, 2025
@Noratrieb
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 23, 2025

📌 Commit 162fb71 has been approved by Noratrieb

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 23, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 24, 2025
Allow `IndexSlice` to be indexed by ranges.

This comes with some annoyances as the index type can no longer inferred from indexing expressions. The biggest offender for this is `IndexVec::from_fn_n(|idx| ..., n)` where the index type won't be inferred from the call site or any index expressions inside the closure.

My main use case for this is mapping a `Place` to `Range<Idx>` for value tracking where the range represents all the values the place contains.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#131282 (std: detect stack overflows in TLS destructors on UNIX)
 - rust-lang#136610 (Allow `IndexSlice` to be indexed by ranges.)
 - rust-lang#136991 ([rustdoc] Add new setting to wrap source code lines when too long)
 - rust-lang#137393 (Stabilize `unbounded_shifts`)
 - rust-lang#137482 (Windows: use existing wrappers in `File::open_native`)
 - rust-lang#137484 (Fix documentation for unstable sort on slice)
 - rust-lang#137491 (Tighten `str-to-string-128690.rs``CHECK{,-NOT}`s to make it less likely to incorrectly fail with symbol name mangling)
 - rust-lang#137495 (Added into_value function to ControlFlow<T, T>)
 - rust-lang#137501 (Move `impl` blocks out of `rustc_middle/src/mir/syntax.rs`)

Failed merges:

 - rust-lang#137489 (remove `#[rustc_intrinsic_must_be_overridde]`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang#136610 (Allow `IndexSlice` to be indexed by ranges.)
 - rust-lang#136991 ([rustdoc] Add new setting to wrap source code lines when too long)
 - rust-lang#137061 (Unstable `gen_future` Feature Tracking  )
 - rust-lang#137393 (Stabilize `unbounded_shifts`)
 - rust-lang#137482 (Windows: use existing wrappers in `File::open_native`)
 - rust-lang#137484 (Fix documentation for unstable sort on slice)
 - rust-lang#137491 (Tighten `str-to-string-128690.rs``CHECK{,-NOT}`s to make it less likely to incorrectly fail with symbol name mangling)
 - rust-lang#137495 (Added into_value function to ControlFlow<T, T>)
 - rust-lang#137501 (Move `impl` blocks out of `rustc_middle/src/mir/syntax.rs`)
 - rust-lang#137505 (Add a span to `CompilerBuiltinsCannotCall`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6aa015a into rust-lang:master Feb 24, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 24, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2025
Rollup merge of rust-lang#136610 - Jarcho:range_idx, r=Noratrieb

Allow `IndexSlice` to be indexed by ranges.

This comes with some annoyances as the index type can no longer inferred from indexing expressions. The biggest offender for this is `IndexVec::from_fn_n(|idx| ..., n)` where the index type won't be inferred from the call site or any index expressions inside the closure.

My main use case for this is mapping a `Place` to `Range<Idx>` for value tracking where the range represents all the values the place contains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants