Fix transmute intrinsic mir validation ICE
This commit is contained in:
parent
696aaad58c
commit
d8ed2fb0bb
2 changed files with 27 additions and 2 deletions
|
@ -679,13 +679,21 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
|||
// Unlike `mem::transmute`, a MIR `Transmute` is well-formed
|
||||
// for any two `Sized` types, just potentially UB to run.
|
||||
|
||||
if !op_ty.is_sized(self.tcx, self.param_env) {
|
||||
if !self
|
||||
.tcx
|
||||
.normalize_erasing_regions(self.param_env, op_ty)
|
||||
.is_sized(self.tcx, self.param_env)
|
||||
{
|
||||
self.fail(
|
||||
location,
|
||||
format!("Cannot transmute from non-`Sized` type {op_ty:?}"),
|
||||
);
|
||||
}
|
||||
if !target_type.is_sized(self.tcx, self.param_env) {
|
||||
if !self
|
||||
.tcx
|
||||
.normalize_erasing_regions(self.param_env, *target_type)
|
||||
.is_sized(self.tcx, self.param_env)
|
||||
{
|
||||
self.fail(
|
||||
location,
|
||||
format!("Cannot transmute to non-`Sized` type {target_type:?}"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue