about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-22 13:06:50 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-26 22:50:17 +0100
commit6937ca2c90961d12cf84fa743cfc34f206d7d75c (patch)
tree419b3335a7066a84f0bf043d09d0b430c3e17ad4
parentcb8d1c3c65a0ce88df45acb63fbeb31e19de36ea (diff)
downloadrust-6937ca2c90961d12cf84fa743cfc34f206d7d75c.tar.gz
rust-6937ca2c90961d12cf84fa743cfc34f206d7d75c.zip
Explain the currently necessary existance of `TransmuteSizeDiff`
-rw-r--r--src/librustc_mir/interpret/place.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs
index 50953348fdc..b384de571fa 100644
--- a/src/librustc_mir/interpret/place.rs
+++ b/src/librustc_mir/interpret/place.rs
@@ -924,6 +924,10 @@ 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 likey we *are* running `typeck` right now. Investigate whether we can bail out
+            // on `typeck_tables().has_errors` at all const eval entry points.
             error!("Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest);
             throw_unsup!(TransmuteSizeDiff(src.layout.ty, dest.layout.ty));
         }