]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/extern-fn-with-union/test.rs
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
[rust.git] / tests / run-make-fulldeps / extern-fn-with-union / test.rs
1 extern crate testcrate;
2
3 use std::mem;
4
5 extern "C" {
6     fn give_back(tu: testcrate::TestUnion) -> u64;
7 }
8
9 fn main() {
10     let magic: u64 = 0xDEADBEEF;
11
12     // Let's test calling it cross crate
13     let back = unsafe { testcrate::give_back(mem::transmute(magic)) };
14     assert_eq!(magic, back);
15
16     // And just within this crate
17     let back = unsafe { give_back(mem::transmute(magic)) };
18     assert_eq!(magic, back);
19 }