summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_gcc/tests
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests')
-rw-r--r--compiler/rustc_codegen_gcc/tests/lang_tests_common.rs70
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/abort1.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/abort2.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/array.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/asm.rs16
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/assign.rs4
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/closure.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/condition.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/empty_main.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/exit.rs1
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/exit_code.rs1
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/gep.rs10
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/int_overflow.rs138
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/mut_ref.rs4
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/operations.rs4
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/return-tuple.rs1
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/slice.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/static.rs3
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/structs.rs1
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/tuple.rs1
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/volatile.rs26
23 files changed, 157 insertions, 150 deletions
diff --git a/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs b/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs
index 06de26f7e..af0133aad 100644
--- a/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs
+++ b/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs
@@ -1,7 +1,7 @@
//! The common code for `tests/lang_tests_*.rs`
use std::{
env::{self, current_dir},
- path::PathBuf,
+ path::{Path, PathBuf},
process::Command,
};
@@ -23,9 +23,29 @@ pub fn main_inner(profile: Profile) {
let gcc_path = include_str!("../gcc_path");
let gcc_path = gcc_path.trim();
env::set_var("LD_LIBRARY_PATH", gcc_path);
+
+ fn rust_filter(filename: &Path) -> bool {
+ filename.extension().expect("extension").to_str().expect("to_str") == "rs"
+ }
+
+ #[cfg(feature="master")]
+ fn filter(filename: &Path) -> bool {
+ rust_filter(filename)
+ }
+
+ #[cfg(not(feature="master"))]
+ fn filter(filename: &Path) -> bool {
+ if let Some(filename) = filename.to_str() {
+ if filename.ends_with("gep.rs") {
+ return false;
+ }
+ }
+ rust_filter(filename)
+ }
+
LangTester::new()
.test_dir("tests/run")
- .test_file_filter(|path| path.extension().expect("extension").to_str().expect("to_str") == "rs")
+ .test_file_filter(filter)
.test_extract(|source| {
let lines =
source.lines()
@@ -50,6 +70,19 @@ pub fn main_inner(profile: Profile) {
"-o", exe.to_str().expect("to_str"),
path.to_str().expect("to_str"),
]);
+
+ // TODO(antoyo): find a way to send this via a cli argument.
+ let test_target = std::env::var("CG_GCC_TEST_TARGET");
+ if let Ok(ref target) = test_target {
+ compiler.args(&["--target", &target]);
+ let linker = format!("{}-gcc", target);
+ compiler.args(&[format!("-Clinker={}", linker)]);
+ let mut env_path = std::env::var("PATH").unwrap_or_default();
+ // TODO(antoyo): find a better way to add the PATH necessary locally.
+ env_path = format!("/opt/m68k-unknown-linux-gnu/bin:{}", env_path);
+ compiler.env("PATH", env_path);
+ }
+
if let Some(flags) = option_env!("TEST_FLAGS") {
for flag in flags.split_whitespace() {
compiler.arg(&flag);
@@ -65,8 +98,37 @@ pub fn main_inner(profile: Profile) {
}
}
// Test command 2: run `tempdir/x`.
- let runtime = Command::new(exe);
- vec![("Compiler", compiler), ("Run-time", runtime)]
+ if test_target.is_ok() {
+ let vm_parent_dir = std::env::var("CG_GCC_VM_DIR")
+ .map(|dir| PathBuf::from(dir))
+ .unwrap_or_else(|_| std::env::current_dir().unwrap());
+ let vm_dir = "vm";
+ let exe_filename = exe.file_name().unwrap();
+ let vm_home_dir = vm_parent_dir.join(vm_dir).join("home");
+ let vm_exe_path = vm_home_dir.join(exe_filename);
+ // FIXME(antoyo): panicking here makes the test pass.
+ let inside_vm_exe_path = PathBuf::from("/home").join(&exe_filename);
+ let mut copy = Command::new("sudo");
+ copy.arg("cp");
+ copy.args(&[&exe, &vm_exe_path]);
+
+ let mut runtime = Command::new("sudo");
+ runtime.args(&["chroot", vm_dir, "qemu-m68k-static"]);
+ runtime.arg(inside_vm_exe_path);
+ runtime.current_dir(vm_parent_dir);
+ vec![
+ ("Compiler", compiler),
+ ("Copy", copy),
+ ("Run-time", runtime),
+ ]
+ }
+ else {
+ let runtime = Command::new(exe);
+ vec![
+ ("Compiler", compiler),
+ ("Run-time", runtime),
+ ]
+ }
})
.run();
}
diff --git a/compiler/rustc_codegen_gcc/tests/run/abort1.rs b/compiler/rustc_codegen_gcc/tests/run/abort1.rs
index 25041d93e..44297e127 100644
--- a/compiler/rustc_codegen_gcc/tests/run/abort1.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/abort1.rs
@@ -3,7 +3,8 @@
// Run-time:
// status: signal
-#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/abort2.rs b/compiler/rustc_codegen_gcc/tests/run/abort2.rs
index e7443c8db..ce8169271 100644
--- a/compiler/rustc_codegen_gcc/tests/run/abort2.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/abort2.rs
@@ -3,7 +3,8 @@
// Run-time:
// status: signal
-#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/array.rs b/compiler/rustc_codegen_gcc/tests/run/array.rs
index 49b28d98f..afd0eed82 100644
--- a/compiler/rustc_codegen_gcc/tests/run/array.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/array.rs
@@ -7,7 +7,8 @@
// 5
// 10
-#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/asm.rs b/compiler/rustc_codegen_gcc/tests/run/asm.rs
index 38c1eac7a..56f2aac3d 100644
--- a/compiler/rustc_codegen_gcc/tests/run/asm.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/asm.rs
@@ -5,8 +5,10 @@
#![feature(asm_const)]
+#[cfg(target_arch="x86_64")]
use std::arch::{asm, global_asm};
+#[cfg(target_arch="x86_64")]
global_asm!(
"
.global add_asm
@@ -20,6 +22,7 @@ extern "C" {
fn add_asm(a: i64, b: i64) -> i64;
}
+#[cfg(target_arch="x86_64")]
pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
asm!(
"rep movsb",
@@ -30,7 +33,8 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
);
}
-fn main() {
+#[cfg(target_arch="x86_64")]
+fn asm() {
unsafe {
asm!("nop");
}
@@ -124,7 +128,7 @@ fn main() {
// check const (ATT syntax)
let mut x: u64 = 42;
unsafe {
- asm!("add {}, {}",
+ asm!("add ${}, {}",
const 1,
inout(reg) x,
options(att_syntax)
@@ -173,3 +177,11 @@ fn main() {
}
assert_eq!(array1, array2);
}
+
+#[cfg(not(target_arch="x86_64"))]
+fn asm() {
+}
+
+fn main() {
+ asm();
+}
diff --git a/compiler/rustc_codegen_gcc/tests/run/assign.rs b/compiler/rustc_codegen_gcc/tests/run/assign.rs
index 427c1a250..5b0db2da2 100644
--- a/compiler/rustc_codegen_gcc/tests/run/assign.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/assign.rs
@@ -5,8 +5,8 @@
// 7 8
// 10
-#![allow(unused_attributes)]
-#![feature(auto_traits, lang_items, no_core, start, intrinsics, track_caller)]
+#![allow(internal_features, unused_attributes)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs, track_caller)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/closure.rs b/compiler/rustc_codegen_gcc/tests/run/closure.rs
index 8daa681ab..4ce528f86 100644
--- a/compiler/rustc_codegen_gcc/tests/run/closure.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/closure.rs
@@ -9,7 +9,8 @@
// Both args: 11
#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics,
- unboxed_closures)]
+ unboxed_closures, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/condition.rs b/compiler/rustc_codegen_gcc/tests/run/condition.rs
index b7a13081d..1b3ae6dc0 100644
--- a/compiler/rustc_codegen_gcc/tests/run/condition.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/condition.rs
@@ -5,7 +5,8 @@
// stdout: true
// 1
-#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/empty_main.rs b/compiler/rustc_codegen_gcc/tests/run/empty_main.rs
index c02cfd2a8..e66a859ad 100644
--- a/compiler/rustc_codegen_gcc/tests/run/empty_main.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/empty_main.rs
@@ -4,6 +4,7 @@
// status: 0
#![feature(auto_traits, lang_items, no_core, start)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
@@ -34,6 +35,6 @@ pub(crate) unsafe auto trait Freeze {}
*/
#[start]
-fn main(mut argc: isize, _argv: *const *const u8) -> isize {
+fn main(_argc: isize, _argv: *const *const u8) -> isize {
0
}
diff --git a/compiler/rustc_codegen_gcc/tests/run/exit.rs b/compiler/rustc_codegen_gcc/tests/run/exit.rs
index 956e53dd4..bf1cbeef3 100644
--- a/compiler/rustc_codegen_gcc/tests/run/exit.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/exit.rs
@@ -4,6 +4,7 @@
// status: 2
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/exit_code.rs b/compiler/rustc_codegen_gcc/tests/run/exit_code.rs
index eeab35209..be7a233ef 100644
--- a/compiler/rustc_codegen_gcc/tests/run/exit_code.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/exit_code.rs
@@ -4,6 +4,7 @@
// status: 1
#![feature(auto_traits, lang_items, no_core, start)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs b/compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs
index 8a196f774..960303597 100644
--- a/compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs
@@ -4,7 +4,8 @@
// status: 0
// stdout: 1
-#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/gep.rs b/compiler/rustc_codegen_gcc/tests/run/gep.rs
new file mode 100644
index 000000000..c3d1672cf
--- /dev/null
+++ b/compiler/rustc_codegen_gcc/tests/run/gep.rs
@@ -0,0 +1,10 @@
+// Compiler:
+//
+// Run-time:
+// status: 0
+
+fn main() {
+ let mut value = (1, 1);
+ let ptr = &mut value as *mut (i32, i32);
+ println!("{:?}", ptr.wrapping_offset(10));
+}
diff --git a/compiler/rustc_codegen_gcc/tests/run/int_overflow.rs b/compiler/rustc_codegen_gcc/tests/run/int_overflow.rs
index c3fcb3c0a..78872159f 100644
--- a/compiler/rustc_codegen_gcc/tests/run/int_overflow.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/int_overflow.rs
@@ -4,138 +4,20 @@
// stdout: Success
// status: signal
-#![allow(unused_attributes)]
-#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+fn main() {
+ std::panic::set_hook(Box::new(|_| {
+ println!("Success");
+ std::process::abort();
+ }));
-#![no_std]
-#![no_core]
-
-/*
- * Core
- */
-
-// Because we don't have core yet.
-#[lang = "sized"]
-pub trait Sized {}
-
-#[lang = "copy"]
-trait Copy {
-}
-
-impl Copy for isize {}
-impl Copy for *mut i32 {}
-impl Copy for usize {}
-impl Copy for i32 {}
-impl Copy for u8 {}
-impl Copy for i8 {}
-
-#[lang = "receiver"]
-trait Receiver {
-}
-
-#[lang = "freeze"]
-pub(crate) unsafe auto trait Freeze {}
-
-#[lang = "panic_location"]
-struct PanicLocation {
- file: &'static str,
- line: u32,
- column: u32,
-}
-
-mod libc {
- #[link(name = "c")]
- extern "C" {
- pub fn puts(s: *const u8) -> i32;
- pub fn fflush(stream: *mut i32) -> i32;
-
- pub static stdout: *mut i32;
- }
-}
-
-mod intrinsics {
- extern "rust-intrinsic" {
- #[rustc_safe_intrinsic]
- pub fn abort() -> !;
- }
-}
-
-#[lang = "panic"]
-#[track_caller]
-#[no_mangle]
-pub fn panic(_msg: &'static str) -> ! {
- unsafe {
- // Panicking is expected iff overflow checking is enabled.
- #[cfg(debug_assertions)]
- libc::puts("Success\0" as *const str as *const u8);
- libc::fflush(libc::stdout);
- intrinsics::abort();
- }
-}
-
-#[lang = "add"]
-trait Add<RHS = Self> {
- type Output;
-
- fn add(self, rhs: RHS) -> Self::Output;
-}
-
-impl Add for u8 {
- type Output = Self;
-
- fn add(self, rhs: Self) -> Self {
- self + rhs
- }
-}
-
-impl Add for i8 {
- type Output = Self;
-
- fn add(self, rhs: Self) -> Self {
- self + rhs
- }
-}
-
-impl Add for i32 {
- type Output = Self;
-
- fn add(self, rhs: Self) -> Self {
- self + rhs
- }
-}
-
-impl Add for usize {
- type Output = Self;
-
- fn add(self, rhs: Self) -> Self {
- self + rhs
- }
-}
-
-impl Add for isize {
- type Output = Self;
-
- fn add(self, rhs: Self) -> Self {
- self + rhs
- }
-}
-
-/*
- * Code
- */
-
-#[start]
-fn main(mut argc: isize, _argv: *const *const u8) -> isize {
- let int = 9223372036854775807isize;
- let int = int + argc; // overflow
+ let arg_count = std::env::args().count();
+ let int = isize::MAX;
+ let _int = int + arg_count as isize; // overflow
// If overflow checking is disabled, we should reach here.
#[cfg(not(debug_assertions))]
unsafe {
- libc::puts("Success\0" as *const str as *const u8);
- libc::fflush(libc::stdout);
- intrinsics::abort();
+ println!("Success");
+ std::process::abort();
}
-
- int
}
diff --git a/compiler/rustc_codegen_gcc/tests/run/mut_ref.rs b/compiler/rustc_codegen_gcc/tests/run/mut_ref.rs
index 2a2ea8b8b..194e55a3d 100644
--- a/compiler/rustc_codegen_gcc/tests/run/mut_ref.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/mut_ref.rs
@@ -7,8 +7,8 @@
// 6
// 11
-#![allow(unused_attributes)]
-#![feature(auto_traits, lang_items, no_core, start, intrinsics, track_caller)]
+#![allow(internal_features, unused_attributes)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs, track_caller)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/operations.rs b/compiler/rustc_codegen_gcc/tests/run/operations.rs
index 67b9f241d..2d7816708 100644
--- a/compiler/rustc_codegen_gcc/tests/run/operations.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/operations.rs
@@ -5,8 +5,8 @@
// 39
// 10
-#![allow(unused_attributes)]
-#![feature(auto_traits, lang_items, no_core, start, intrinsics, arbitrary_self_types)]
+#![allow(internal_features, unused_attributes)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, arbitrary_self_types, rustc_attrs)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs b/compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs
index da8a8295d..09d77abe2 100644
--- a/compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs
@@ -4,7 +4,8 @@
// status: 0
// stdout: 1
-#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/return-tuple.rs b/compiler/rustc_codegen_gcc/tests/run/return-tuple.rs
index 6fa10dca0..8d40deb8c 100644
--- a/compiler/rustc_codegen_gcc/tests/run/return-tuple.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/return-tuple.rs
@@ -7,6 +7,7 @@
// 42
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/slice.rs b/compiler/rustc_codegen_gcc/tests/run/slice.rs
index 96f1c4792..1262c86c8 100644
--- a/compiler/rustc_codegen_gcc/tests/run/slice.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/slice.rs
@@ -4,7 +4,8 @@
// status: 0
// stdout: 5
-#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/static.rs b/compiler/rustc_codegen_gcc/tests/run/static.rs
index 19201f1df..0b933754c 100644
--- a/compiler/rustc_codegen_gcc/tests/run/static.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/static.rs
@@ -9,7 +9,8 @@
// 12
// 1
-#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/structs.rs b/compiler/rustc_codegen_gcc/tests/run/structs.rs
index 6c8884855..d64556674 100644
--- a/compiler/rustc_codegen_gcc/tests/run/structs.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/structs.rs
@@ -6,6 +6,7 @@
// 2
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/tuple.rs b/compiler/rustc_codegen_gcc/tests/run/tuple.rs
index 0b670bf26..8a7d85ae8 100644
--- a/compiler/rustc_codegen_gcc/tests/run/tuple.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/tuple.rs
@@ -5,6 +5,7 @@
// stdout: 3
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
+#![allow(internal_features)]
#![no_std]
#![no_core]
diff --git a/compiler/rustc_codegen_gcc/tests/run/volatile.rs b/compiler/rustc_codegen_gcc/tests/run/volatile.rs
new file mode 100644
index 000000000..8b0433125
--- /dev/null
+++ b/compiler/rustc_codegen_gcc/tests/run/volatile.rs
@@ -0,0 +1,26 @@
+// Compiler:
+//
+// Run-time:
+// status: 0
+
+use std::mem::MaybeUninit;
+
+#[derive(Debug)]
+struct Struct {
+ pointer: *const (),
+ func: unsafe fn(*const ()),
+}
+
+fn func(ptr: *const ()) {
+}
+
+fn main() {
+ let mut x = MaybeUninit::<&Struct>::uninit();
+ x.write(&Struct {
+ pointer: std::ptr::null(),
+ func,
+ });
+ let x = unsafe { x.assume_init() };
+ let value = unsafe { (x as *const Struct).read_volatile() };
+ println!("{:?}", value);
+}