diff options
| author | bors <bors@rust-lang.org> | 2020-03-09 22:09:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-09 22:09:51 +0000 |
| commit | b8cedc00407a4c56a3bda1ed605c6fc166655447 (patch) | |
| tree | c6dcbe9711ea6d5a31429a833a3d0c59cbbb2578 /src/librustc_mir/interpret/place.rs | |
| parent | b08d07143d2b61777d341f8658281adc0f2ac809 (diff) | |
| parent | 133f659766c60ff7a33288ae6f33b0c272792f57 (diff) | |
| download | rust-1.42.0.tar.gz rust-1.42.0.zip | |
Auto merge of #69854 - pietroalbini:stable-next, r=Centril 1.42.0
[stable] Release 1.42.0 This PR prepares the release artifacts of Rust 1.42.0, and cherry-picks the following PRs: * https://github.com/rust-lang/rust/pull/69754: Update deprecation version to 1.42 for Error::description * https://github.com/rust-lang/rust/pull/69753: Do not ICE when matching an uninhabited enum's field * https://github.com/rust-lang/rust/pull/69522 / https://github.com/rust-lang/rust/pull/69853: error_derive_forbidden_on_non_adt: be more graceful * https://github.com/rust-lang/rust/pull/68598: Fix null synthetic_implementors error In addition, the release notes are updated to include the remaining compatibility notes. r? @Centril
Diffstat (limited to 'src/librustc_mir/interpret/place.rs')
| -rw-r--r-- | src/librustc_mir/interpret/place.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 4f96cb69891..721766cc932 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -410,6 +410,14 @@ where stride * field } layout::FieldPlacement::Union(count) => { + // This is a narrow bug-fix for rust-lang/rust#69191: if we are + // trying to access absent field of uninhabited variant, then + // signal UB (but don't ICE the compiler). + // FIXME temporary hack to work around incoherence between + // layout computation and MIR building + if field >= count as u64 && base.layout.abi == layout::Abi::Uninhabited { + throw_ub!(Unreachable); + } assert!( field < count as u64, "Tried to access field {} of union {:#?} with {} fields", |
