diff options
| author | bors <bors@rust-lang.org> | 2022-05-27 11:31:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-27 11:31:37 +0000 |
| commit | 56fd680cf9226ab424f88d4e3b43c5e088d17f19 (patch) | |
| tree | aa1cb6dee38662302ec1969d5d092ec733ac3396 /compiler/rustc_const_eval/src | |
| parent | 46147119ec545045948bc799581d93edd3b1617b (diff) | |
| parent | 4332c2fbbd47ecdcfb620a284254feed3367bec4 (diff) | |
| download | rust-56fd680cf9226ab424f88d4e3b43c5e088d17f19.tar.gz rust-56fd680cf9226ab424f88d4e3b43c5e088d17f19.zip | |
Auto merge of #96046 - oli-obk:const_typeck, r=cjgillot
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index dc49a45fe73..955480a1a74 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -906,16 +906,12 @@ where } // We still require the sizes to match. if src.layout.size != dest.layout.size { - // FIXME: This should be an assert instead of an error, but if we transmute within an - // array length computation, `typeck` may not have yet been run and errored out. In fact - // most likely we *are* running `typeck` right now. Investigate whether we can bail out - // on `typeck_results().has_errors` at all const eval entry points. - debug!("Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest); - self.tcx.sess.delay_span_bug( + span_bug!( self.cur_span(), - "size-changing transmute, should have been caught by transmute checking", + "size-changing transmute, should have been caught by transmute checking: {:#?}\ndest: {:#?}", + src, + dest ); - throw_inval!(TransmuteSizeDiff(src.layout.ty, dest.layout.ty)); } // Unsized copies rely on interpreting `src.meta` with `dest.layout`, we want // to avoid that here. |
