Explain the currently necessary existance of TransmuteSizeDiff

This commit is contained in:
Oliver Scherer 2019-12-22 13:06:50 +01:00
parent cb8d1c3c65
commit 6937ca2c90

View File

@ -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));
}