Skip to content

Commit b4a84cb

Browse files
committed
Post-rebase test updates
1 parent fab49f0 commit b4a84cb

6 files changed

Lines changed: 27 additions & 4 deletions

File tree

tests/unit/out/unsafe/huffman.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::collections::BTreeMap;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
9+
#[repr(C)]
910
#[derive(Copy, Clone, Default)]
1011
pub struct MinHeapNode {
1112
pub data: u8,
@@ -40,6 +41,7 @@ pub unsafe fn Swap_0(a: *mut MinHeapNode, b: *mut MinHeapNode) {
4041
})
4142
.clone();
4243
}
44+
#[repr(C)]
4345
#[derive(Default)]
4446
pub struct MinHeap {
4547
pub size: i32,

tests/unit/out/unsafe/polymorphism.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ use std::rc::Rc;
99
pub unsafe trait Animal {
1010
unsafe fn bark(&self) -> bool;
1111
}
12+
#[repr(C)]
1213
#[derive(Copy, Clone, Default)]
1314
pub struct Dog {}
1415
unsafe impl Animal for Dog {
1516
unsafe fn bark(&self) -> bool {
1617
return true;
1718
}
1819
}
20+
#[repr(C)]
1921
#[derive(Copy, Clone, Default)]
2022
pub struct Cat {}
2123
impl Cat {

tests/unit/out/unsafe/union_tagged_many_arms.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ enum Tag {
1515
T_FLOAT = 3,
1616
T_REF = 4,
1717
}
18-
#[derive(Copy, Clone, Default)]
19-
pub struct Slot_anon_0 {
18+
#[repr(C)]
19+
#[derive(Copy, Clone)]
20+
pub union Slot_anon_0 {
2021
pub text: *const u8,
2122
pub handle: *mut ::libc::c_void,
2223
pub signed_n: i64,
2324
pub unsigned_n: u64,
2425
pub f: f64,
2526
}
27+
impl Default for Slot_anon_0 {
28+
fn default() -> Self {
29+
unsafe { std::mem::zeroed() }
30+
}
31+
}
32+
#[repr(C)]
2633
#[derive(Copy, Clone, Default)]
2734
pub struct Slot {
2835
pub tag: Tag,

tests/unit/out/unsafe/union_tagged_struct_arms.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ enum Choice {
1313
C_LETTERS = 2,
1414
C_INTEGERS = 3,
1515
}
16+
#[repr(C)]
1617
#[derive(Copy, Clone, Default)]
1718
pub struct Branch_anon_0_anon_0 {
1819
pub items: *mut *mut u8,
1920
pub count: i64,
2021
pub cursor: i64,
2122
}
23+
#[repr(C)]
2224
#[derive(Copy, Clone, Default)]
2325
pub struct Branch_anon_0_anon_1 {
2426
pub lo: i32,
2527
pub hi: i32,
2628
pub curr: i32,
2729
pub step: u8,
2830
}
31+
#[repr(C)]
2932
#[derive(Copy, Clone, Default)]
3033
pub struct Branch_anon_0_anon_2 {
3134
pub lo: i64,
@@ -34,12 +37,19 @@ pub struct Branch_anon_0_anon_2 {
3437
pub step: i64,
3538
pub width: i32,
3639
}
37-
#[derive(Copy, Clone, Default)]
38-
pub struct Branch_anon_0 {
40+
#[repr(C)]
41+
#[derive(Copy, Clone)]
42+
pub union Branch_anon_0 {
3943
pub list: Branch_anon_0_anon_0,
4044
pub letters: Branch_anon_0_anon_1,
4145
pub integers: Branch_anon_0_anon_2,
4246
}
47+
impl Default for Branch_anon_0 {
48+
fn default() -> Self {
49+
unsafe { std::mem::zeroed() }
50+
}
51+
}
52+
#[repr(C)]
4353
#[derive(Copy, Clone, Default)]
4454
pub struct Branch {
4555
pub choice: Choice,

tests/unit/out/unsafe/unique_ptr_const_deref.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::collections::BTreeMap;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
9+
#[repr(C)]
910
#[derive(Default)]
1011
pub struct Holder {
1112
pub val: Option<Box<i32>>,

tests/unit/out/unsafe/va_arg_struct_ctx.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::collections::BTreeMap;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
9+
#[repr(C)]
910
#[derive(Copy, Clone, Default)]
1011
pub struct context {
1112
pub verbose: i32,

0 commit comments

Comments
 (0)