about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Burka <durka42+github@gmail.com>2016-06-14 15:53:55 -0400
committerAlex Burka <aburka@seas.upenn.edu>2016-07-27 13:58:51 -0400
commit54ecc210ec720e93c6e493e6fc3e7464cd22002f (patch)
treee86d22f788a132110530e66ac370d275d75adf63
parent5276b2967060d749e20674a08a2438a24f0f7b07 (diff)
downloadrust-54ecc210ec720e93c6e493e6fc3e7464cd22002f.tar.gz
rust-54ecc210ec720e93c6e493e6fc3e7464cd22002f.zip
hack to make example compile
-rw-r--r--src/doc/book/ffi.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/doc/book/ffi.md b/src/doc/book/ffi.md
index e63516e58cc..e1b9789a314 100644
--- a/src/doc/book/ffi.md
+++ b/src/doc/book/ffi.md
@@ -598,17 +598,21 @@ we have function pointers flying across the FFI boundary in both directions.
 ```rust
 use std::os::raw::c_int;
 
+# #[cfg(hidden)]
 extern "C" {
     /// Register the callback.
     fn register(cb: Option<extern "C" fn(Option<extern "C" fn(c_int) -> c_int>, c_int) -> c_int>);
 }
+# unsafe fn register(_: Option<extern "C" fn(Option<extern "C" fn(c_int) -> c_int>,
+#                                            c_int) -> c_int>)
+# {}
 
 /// This fairly useless function receives a function pointer and an integer
 /// from C, and returns the result of calling the function with the integer.
 /// In case no function is provided, it squares the integer by default.
 extern "C" fn apply(process: Option<extern "C" fn(c_int) -> c_int>, int: c_int) -> c_int {
     match process {
-        Some(f) => unsafe { f(int) },
+        Some(f) => f(int),
         None    => int * int
     }
 }