Skip to content

Commit efbbc69

Browse files
committed
Explain the currently necessary existance of TransmuteSizeDiff
1 parent 5b278bc commit efbbc69

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
@@ -942,6 +942,10 @@ where
942942
}
943943
// We still require the sizes to match.
944944
if src.layout.size != dest.layout.size {
945+
// FIXME: This should be an assert instead of an error, but if we transmute within an
946+
// array length computation, `typeck` may not have yet been run and errored out. In fact
947+
// most likey we *are* running `typeck` right now. Investigate whether we can bail out
948+
// on `typeck_tables().has_errors` at all const eval entry points.
945949
error!("Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest);
946950
throw_unsup!(TransmuteSizeDiff(src.layout.ty, dest.layout.ty));
947951
}

0 commit comments

Comments
 (0)