1
Fork 0

Lower the assume intrinsic to a MIR statement

This commit is contained in:
Oli Scherer 2022-06-30 08:16:05 +00:00
parent 3c72788461
commit 3f07645120
33 changed files with 212 additions and 30 deletions

View file

@ -679,6 +679,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
| StatementKind::AscribeUserType(..)
| StatementKind::Coverage(..)
| StatementKind::CopyNonOverlapping(..)
| StatementKind::Assume(..)
| StatementKind::Nop => {}
}
}

View file

@ -636,6 +636,15 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
);
}
}
StatementKind::Assume(box ref op) => {
let ty = op.ty(&self.body.local_decls, self.tcx);
if !ty.is_bool() {
self.fail(
location,
format!("`assume` argument must be `bool`, but got: `{}`", ty),
);
}
}
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
ref src,
ref dst,