-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Get with field index from pattern slice instead of directly indexing #82789
Conversation
This comment has been minimized.
This comment has been minimized.
9b10ffd
to
ff35210
Compare
This comment has been minimized.
This comment has been minimized.
@estebank ping |
Could you add a test for the more than one field case? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@estebank kind of strange as I fixed that with |
I have a theory: we already emit privacy errors pointing at the ADT on some cases of private fields, so the error for the field themselves would only be redundant. The ICE you're fixing only happens on non-existing fields, and the new error is just precluding getting to that. Could you verify whether my theory is correct? I'm swamped until next week to do this kind of light digging :) |
This comment has been minimized.
This comment has been minimized.
@estebank So the real cause is we only generate single pattern for Box here |
@bors r+ rollup |
📌 Commit 77fb6a0 has been approved by |
Get with field index from pattern slice instead of directly indexing Closes rust-lang#82772 r? `@estebank` rust-lang#82789 (comment) > `@estebank` So the real cause is we only generate single pattern for Box here https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1130-L1132 But in the replacing function, it tries to index on the 1-length pattern slice with field 1, thus out of bounds. https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1346
Rollup of 10 pull requests Successful merges: - rust-lang#81465 (Add documentation about formatting `Duration` values) - rust-lang#82121 (Implement Extend and FromIterator for OsString) - rust-lang#82617 (Document `everybody_loops`) - rust-lang#82789 (Get with field index from pattern slice instead of directly indexing) - rust-lang#82798 (Rename `rustdoc` to `rustdoc::all`) - rust-lang#82804 (std: Fix a bug on the wasm32-wasi target opening files) - rust-lang#82943 (Demonstrate best practice for feeding stdin of a child processes) - rust-lang#83066 (Add `reverse` search alias for Iterator::rev()) - rust-lang#83070 (Update cargo) - rust-lang#83081 (Fix panic message of `assert_failed_inner`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Closes #82772
r? @estebank
#82789 (comment)