Skip to content

Commit

Permalink
Work around unsafe static constructor for struct with va_list field
Browse files Browse the repository at this point in the history
  • Loading branch information
dgherzka committed Nov 7, 2023
1 parent 2efdd87 commit 5adceab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tests/structs/src/debug_derive_good.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ typedef struct {
int a;
} S1;

S1 kS1;

typedef struct {
va_list v;
} S3;

S1 kS1;
S3 kS3;
S3 get_struct_containing_va_list() {
S3 s;
return s;
}
5 changes: 3 additions & 2 deletions tests/structs/src/test_debug_derive_good.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! feature_c_variadic,
use crate::debug_derive_good::{rust_kS1, rust_kS3};
use crate::debug_derive_good::{rust_kS1, rust_get_struct_containing_va_list};

pub fn test_simple_struct() {
unsafe {
Expand All @@ -10,6 +10,7 @@ pub fn test_simple_struct() {

pub fn test_struct_containing_va_list() {
unsafe {
format!("{rust_kS3:?}");
let s = rust_get_struct_containing_va_list();
format!("{s:?}");
}
}

0 comments on commit 5adceab

Please sign in to comment.