-
Notifications
You must be signed in to change notification settings - Fork 576
const-eval.const-expr.field: make paragraph more clear #2157
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
Conversation
|
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). |
738ee9d to
debcd3b
Compare
|
Am not sure how to check if the restriction is lifted, but when I try other types, I get this in the compile error...
And, in const context, ranges are not accepted as index type. |
ehuss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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)
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)
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