Skip to content

Commit 6937ca2

Browse files
committed
Explain the currently necessary existance of TransmuteSizeDiff
1 parent cb8d1c3 commit 6937ca2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/interpret/place.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,10 @@ where
924924
}
925925
// We still require the sizes to match.
926926
if src.layout.size != dest.layout.size {
927+
// FIXME: This should be an assert instead of an error, but if we transmute within an
928+
// array length computation, `typeck` may not have yet been run and errored out. In fact
929+
// most likey we *are* running `typeck` right now. Investigate whether we can bail out
930+
// on `typeck_tables().has_errors` at all const eval entry points.
927931
error!("Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest);
928932
throw_unsup!(TransmuteSizeDiff(src.layout.ty, dest.layout.ty));
929933
}

0 commit comments

Comments
 (0)