Add the transmute and asm checks to typeck as deferred checks

This commit is contained in:
Oli Scherer 2022-04-14 12:07:36 +00:00
parent 0fdaaadb36
commit 0d88631059
38 changed files with 678 additions and 364 deletions

View file

@ -910,12 +910,12 @@ where
// 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.