Skip to content

Commit b16282e

Browse files
committed
analyze: rewrite::mir_op: reformat assert in Callee::Null case
1 parent f79caef commit b16282e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

c2rust-analyze/src/rewrite/expr/mir_op.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,11 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
519519
Callee::Null { .. } => {
520520
self.enter_rvalue(|v| {
521521
if !v.flags[pl_ty.label].contains(FlagSet::FIXED) {
522-
let arg_non_null =
523-
v.perms[pl_ty.label].contains(PermissionSet::NON_NULL);
524-
if arg_non_null {
525-
panic!("impossible: result of null() is a NON_NULL pointer?");
526-
} else {
527-
v.emit(RewriteKind::PtrNullToNone);
528-
}
522+
assert!(
523+
!v.perms[pl_ty.label].contains(PermissionSet::NON_NULL),
524+
"impossible: result of null() is a NON_NULL pointer?"
525+
);
526+
v.emit(RewriteKind::PtrNullToNone);
529527
}
530528
});
531529
}

0 commit comments

Comments
 (0)