rust/src/librustc_trans
bors 5e7fd65419 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
2018-01-28 13:24:47 +00:00
..
back Merge branch 'no-stderr-sink' of https://github.com/Zoxc/rust into rollup 2018-01-26 06:49:55 -08:00
debuginfo Rollup merge of #47618 - mrhota:dw_at_noreturn, r=michaelwoerister 2018-01-25 13:49:46 -08:00
mir Fix ICE on const eval of union field 2018-01-27 12:57:01 +11:00
abi.rs rustc: SIMD types use pointers in Rust's ABI 2018-01-25 12:05:24 -08:00
allocator.rs Hide even more of rustc_trans 2018-01-19 20:27:12 +01:00
asm.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
attributes.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
base.rs Rollup merge of #47415 - varkor:cgu-partition-heuristic, r=michaelwoerister 2018-01-25 12:48:44 -06:00
build.rs rustc: Add some build scripts for librustc crates 2017-07-22 22:04:13 -07:00
builder.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
cabi_aarch64.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_arm.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_asmjs.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_hexagon.rs rustc: move size, align & primitive_align from Abi::Aggregate to layout. 2017-11-19 02:14:32 +02:00
cabi_mips.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_mips64.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_msp430.rs rustc: move size, align & primitive_align from Abi::Aggregate to layout. 2017-11-19 02:14:32 +02:00
cabi_nvptx.rs rustc: move size, align & primitive_align from Abi::Aggregate to layout. 2017-11-19 02:14:32 +02:00
cabi_nvptx64.rs rustc: move size, align & primitive_align from Abi::Aggregate to layout. 2017-11-19 02:14:32 +02:00
cabi_powerpc.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_powerpc64.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_s390x.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_sparc.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_sparc64.rs Removed uneeded argument to make_indirect. 2018-01-18 11:03:49 -08:00
cabi_x86.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
cabi_x86_64.rs Rollup merge of #47626 - eddyb:one-less-unwrap, r=nagisa 2018-01-25 13:49:47 -08:00
cabi_x86_win64.rs rustc: unpack newtyped of #[repr(simd)] vector types. 2017-12-13 01:57:56 +02:00
callee.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
Cargo.toml rustc: Load the rustc_trans crate at runtime 2018-01-27 19:16:21 -08:00
common.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
consts.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
context.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
declare.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
diagnostics.rs Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
glue.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
intrinsic.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
lib.rs rustc: Load the rustc_trans crate at runtime 2018-01-27 19:16:21 -08:00
llvm_util.rs Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
metadata.rs Add sync module to rustc_data_structures 2017-12-17 14:14:51 +01:00
meth.rs rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
README.md rework the README.md for rustc and add other readmes 2017-09-19 09:00:59 -04:00
time_graph.rs rustc: Implement ThinLTO 2017-10-07 08:17:52 -07:00
trans_item.rs Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
type_.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
type_of.rs rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
value.rs Inline last remaining use of Callee::call and delete unused code 2016-12-20 20:03:31 -07:00

NB: This crate is part of the Rust compiler. For an overview of the compiler as a whole, see the README.md file found in librustc.

The trans crate contains the code to convert from MIR into LLVM IR, and then from LLVM IR into machine code. In general it contains code that runs towards the end of the compilation process.