about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-28 13:24:47 +0000
committerbors <bors@rust-lang.org>2018-01-28 13:24:47 +0000
commit5e7fd65419384e5322fe18d3c6ea37e59860a9bc (patch)
treeb408d493b9e6ff86c7b240e4b67557e056f4077f /src/libstd/sys/unix/stack_overflow.rs
parent0119b44270243db7479ea946bb0cdd5522c351b6 (diff)
parented7e4e1e27d21d47b93f756e615b5cb750275c3f (diff)
downloadrust-5e7fd65419384e5322fe18d3c6ea37e59860a9bc.tar.gz
rust-5e7fd65419384e5322fe18d3c6ea37e59860a9bc.zip
Auto merge of #47794 - etaoins:fix-ice-on-const-eval-of-union-field, r=eddyb
Fix ICE on const eval of union field

MIR's `Const::get_field()` attempts to retrieve the value for a given field in a constant. In the case of a union constant it was falling through to a generic `const_get_elt` based on the field index. As union fields don't have an index this caused an ICE in `llvm_field_index`.

Fix by simply returning the current value when accessing any field in a union. This works because all union fields start at byte offset 0.

The added test uses `const_fn` it ensure the field is extracted using MIR's const evaluation. The crash is reproducible without it, however.

Fixes #47788

r? @eddyb
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions