]> git.proxmox.com Git - rustc.git/blobdiff - src/test/run-pass/enum-clike-ffi-as-int.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / run-pass / enum-clike-ffi-as-int.rs
index 8be3634c88addb6dc6a3e5027e9903171a65b927..fdaad9e1fabcea336bfe6290b9ca79a54c0c9376 100644 (file)
 
 #[repr(u32)]
 enum Foo {
-  A = 0,
-  B = 23
+    A = 0,
+    B = 23
 }
 
 #[inline(never)]
 extern "C" fn foo(_x: usize) -> Foo { Foo::B }
 
 pub fn main() {
-  unsafe {
-    let f: extern "C" fn(usize) -> u32 = ::std::mem::transmute(foo);
-    assert_eq!(f(0xDEADBEEF), Foo::B as u32);
-  }
+    unsafe {
+        let f: extern "C" fn(usize) -> u32 =
+            ::std::mem::transmute(foo as extern "C" fn(usize) -> Foo);
+        assert_eq!(f(0xDEADBEEF), Foo::B as u32);
+    }
 }