Remove workaround for CastKind::Transmute from const prop

Since constants are no longer validated before propagation the
workaround is obsolete. Remove it.
This commit is contained in:
Tomasz Miąsko 2023-03-27 00:00:00 +00:00
parent bc41973e35
commit 4adb8fbda0
6 changed files with 19 additions and 15 deletions

View file

@ -501,16 +501,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
return None;
}
// Do not try creating references, nor any types with potentially-complex
// invariants. This avoids an issue where checking validity would do a
// bunch of work generating a nice message about the invariant violation,
// only to not show it to anyone (since this isn't the lint).
Rvalue::Cast(CastKind::Transmute, op, dst_ty) if !dst_ty.is_primitive() => {
trace!("skipping Transmute of {:?} to {:?}", op, dst_ty);
return None;
}
// There's no other checking to do at this time.
Rvalue::Aggregate(..)
| Rvalue::Use(..)