]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #82789 - csmoe:issue-82772, r=estebank
authorYuki Okushi <huyuumi.dev@gmail.com>
Sun, 14 Mar 2021 04:07:31 +0000 (13:07 +0900)
committerGitHub <noreply@github.com>
Sun, 14 Mar 2021 04:07:31 +0000 (13:07 +0900)
commit0d9a6edb50ede7496b61e8b6b2eea9944439481a
tree7eb351c1551a289d9024c2c007417dcba8249ebb
parentf0ebc1041042b5246bd0f7539c52a52a84687770
parent77fb6a0f32408925f212d1fb877e900f9736840d
Rollup merge of #82789 - csmoe:issue-82772, r=estebank

Get with field index from pattern slice instead of directly indexing

Closes #82772
r? ``@estebank``

https://github.com/rust-lang/rust/pull/82789#issuecomment-796921977
> ``@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