Skip to content

Conversation

@tshepang
Copy link
Member

@tshepang tshepang commented Feb 3, 2026

This also makes it more clear that this paragraph is about 3 distinct things

/me am not so sure about this, so this can act as request for clarification

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Feb 3, 2026
@ehuss
Copy link
Contributor

ehuss commented Feb 4, 2026

Yea a little confusing, I think the original text is poorly worded.

I think what it is trying to say is that you can use an index expression as long as you are only indexing an array or slice type with a usize.

Should probably check if that is still correct, or if it has been relaxed at all since it was written in 2017 (#13).

@tshepang tshepang force-pushed the patch-3 branch 2 times, most recently from 738ee9d to debcd3b Compare February 4, 2026 10:09
@tshepang tshepang changed the title oxford comma const-eval.const-expr.field: make paragraph more clear Feb 4, 2026
@tshepang
Copy link
Member Author

tshepang commented Feb 4, 2026

Am not sure how to check if the restriction is lifted, but when I try other types, I get this in the compile error...

slice indices are of type usize or ranges of usize

And, in const context, ranges are not accepted as index type.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss enabled auto-merge February 4, 2026 14:34
@ehuss ehuss added this pull request to the merge queue Feb 4, 2026
Merged via the queue into rust-lang:master with commit addd060 Feb 4, 2026
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Feb 4, 2026
@tshepang tshepang deleted the patch-3 branch February 4, 2026 15:34
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 10, 2026
Update books

## rust-lang/book

1 commits in 39aeceaa3aeab845bc4517e7a44e48727d3b9dbe..05d114287b7d6f6c9253d5242540f00fbd6172ab
2026-02-03 15:19:04 UTC to 2026-02-03 15:19:04 UTC

- Temporarily remove the link to `Drop::drop` (rust-lang/book#4576)

## rust-lang/nomicon

1 commits in 050c002a360fa45b701ea34feed7a860dc8a41bf..b8f254a991b8b7e8f704527f0d4f343a4697dfa9
2026-01-29 12:15:01 UTC to 2026-01-29 12:15:01 UTC

- Fix deprecation warning for compare_and_swap in atomics.md (rust-lang/nomicon#519)

## rust-lang/reference

12 commits in 990819b86c22bbf538c0526f0287670f3dc1a67a..addd0602c819b6526b9cc97653b0fadca395528c
2026-02-04 14:35:59 UTC to 2026-01-26 18:02:14 UTC

- const-eval.const-expr.field: make paragraph more clear (rust-lang/reference#2157)
- make more clear what the link target is (rust-lang/reference#2156)
- Update two URLs (rust-lang/reference#2154)
- Add a chapter on divergence (rust-lang/reference#2067)
- Guarantee `repr(C)` union field offset (rust-lang/reference#2128)
- Reference updates for forbidding object lifetime changing pointer casts (rust-lang/reference#1951)
- Clarify only arrays undergo unsized coercion during dispatch (rust-lang/reference#2139)
- Split the textual chapter into separate char and str chapters (rust-lang/reference#2145)
- Document ppc inline asm support (rust-lang/reference#2056)
- Unwrap items, expressions, patterns, and types (rust-lang/reference#2141)
- undefined behavior: add missing plural in `undefined.misaligned.ptr` (rust-lang/reference#2146)
- inline-assembly: add a space to the `asm.abi-clobbers.many` example (rust-lang/reference#2144)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 10, 2026
Update books

## rust-lang/book

1 commits in 39aeceaa3aeab845bc4517e7a44e48727d3b9dbe..05d114287b7d6f6c9253d5242540f00fbd6172ab
2026-02-03 15:19:04 UTC to 2026-02-03 15:19:04 UTC

- Temporarily remove the link to `Drop::drop` (rust-lang/book#4576)

## rust-lang/nomicon

1 commits in 050c002a360fa45b701ea34feed7a860dc8a41bf..b8f254a991b8b7e8f704527f0d4f343a4697dfa9
2026-01-29 12:15:01 UTC to 2026-01-29 12:15:01 UTC

- Fix deprecation warning for compare_and_swap in atomics.md (rust-lang/nomicon#519)

## rust-lang/reference

12 commits in 990819b86c22bbf538c0526f0287670f3dc1a67a..addd0602c819b6526b9cc97653b0fadca395528c
2026-02-04 14:35:59 UTC to 2026-01-26 18:02:14 UTC

- const-eval.const-expr.field: make paragraph more clear (rust-lang/reference#2157)
- make more clear what the link target is (rust-lang/reference#2156)
- Update two URLs (rust-lang/reference#2154)
- Add a chapter on divergence (rust-lang/reference#2067)
- Guarantee `repr(C)` union field offset (rust-lang/reference#2128)
- Reference updates for forbidding object lifetime changing pointer casts (rust-lang/reference#1951)
- Clarify only arrays undergo unsized coercion during dispatch (rust-lang/reference#2139)
- Split the textual chapter into separate char and str chapters (rust-lang/reference#2145)
- Document ppc inline asm support (rust-lang/reference#2056)
- Unwrap items, expressions, patterns, and types (rust-lang/reference#2141)
- undefined behavior: add missing plural in `undefined.misaligned.ptr` (rust-lang/reference#2146)
- inline-assembly: add a space to the `asm.abi-clobbers.many` example (rust-lang/reference#2144)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants