Skip to content

Commit

Permalink
add test for unions (#1012)
Browse files Browse the repository at this point in the history
Adds test showing #995 and #990 are fixed. I believe #1005 and #956
combined fixed these issues.
  • Loading branch information
aneksteind authored Aug 2, 2023
2 parents 2f3a637 + 52d3c3f commit 99c77af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions c2rust-analyze/tests/filecheck/aggregate1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,23 @@ pub unsafe fn repeat() {
}

// CHECK-DAG: #[derive(Clone)]
// CHECK-DAG: struct Foo {
#[derive(Clone)]
struct Foo {
x: i32,
}

// CHECK-DAG: #[derive(Copy, Clone)]
// CHECK-DAG: pub union Onion<'h1> {
#[derive(Copy, Clone)]
pub union Onion {
x: usize,
// CHECK-DAG: y: &'h1 (u8)
y: *mut u8,
}

// CHECK-DAG: struct UseOnion<'h2,'h1> {
struct UseOnion {
// CHECK-DAG: foo: &'h2 (Onion<'h1>)
foo: *mut Onion,
}

0 comments on commit 99c77af

Please sign in to comment.