Skip to content

Commit

Permalink
Check that there is a single non-phantom field
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Sep 28, 2023
1 parent 1cdb54a commit 3b36a9b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ impl<'tcx> GotocCtx<'tcx> {
// The rest of them correspond to phantom data (ZST).
let field_types: Vec<Ty<'_>> =
variant.fields.iter().map(|f| f.ty(self.tcx, subst)).collect();
// Check that there is a single non-phantom field
let non_phantom_field_types: Vec<_> =
field_types.iter().filter(|t| !t.is_phantom_data()).collect();
assert!(
non_phantom_field_types.len() == 1,
"error: expected exactly one field that is not phantom data"
);
let field_values: Vec<Expr> = field_types
.iter()
.map(|t| {
Expand Down

0 comments on commit 3b36a9b

Please sign in to comment.