about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-07-27 13:51:48 -0400
committerAlex Burka <aburka@seas.upenn.edu>2016-07-27 13:58:51 -0400
commit8e7abea93e84af6060ce6eeb530eb82fed3cff60 (patch)
tree8e7778b70b2c9b647d7f2e7e572b9687e069cdec
parent54ecc210ec720e93c6e493e6fc3e7464cd22002f (diff)
downloadrust-8e7abea93e84af6060ce6eeb530eb82fed3cff60.tar.gz
rust-8e7abea93e84af6060ce6eeb530eb82fed3cff60.zip
revert libc changes
-rw-r--r--src/doc/book/ffi.md22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/doc/book/ffi.md b/src/doc/book/ffi.md
index e1b9789a314..983bd46a0c9 100644
--- a/src/doc/book/ffi.md
+++ b/src/doc/book/ffi.md
@@ -461,11 +461,12 @@ global state. In order to access these variables, you declare them in `extern`
 blocks with the `static` keyword:
 
 ```rust,no_run
-use std::os::raw::c_int;
+# #![feature(libc)]
+extern crate libc;
 
 #[link(name = "readline")]
 extern {
-    static rl_readline_version: c_int;
+    static rl_readline_version: libc::c_int;
 }
 
 fn main() {
@@ -479,14 +480,15 @@ interface. To do this, statics can be declared with `mut` so we can mutate
 them.
 
 ```rust,no_run
+# #![feature(libc)]
+extern crate libc;
 
 use std::ffi::CString;
-use std::os::raw::c_char;
 use std::ptr;
 
 #[link(name = "readline")]
 extern {
-    static mut rl_prompt: *const c_char;
+    static mut rl_prompt: *const libc::c_char;
 }
 
 fn main() {
@@ -511,13 +513,14 @@ calling foreign functions. Some foreign functions, most notably the Windows API,
 conventions. Rust provides a way to tell the compiler which convention to use:
 
 ```rust
-use std::os::raw::c_int;
+# #![feature(libc)]
+extern crate libc;
 
 #[cfg(all(target_os = "win32", target_arch = "x86"))]
 #[link(name = "kernel32")]
 #[allow(non_snake_case)]
 extern "stdcall" {
-    fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> c_int;
+    fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int;
 }
 # fn main() { }
 ```
@@ -690,11 +693,12 @@ void bar(void *arg);
 We can represent this in Rust with the `c_void` type:
 
 ```rust
-use std::os::raw::c_void;
+# #![feature(libc)]
+extern crate libc;
 
 extern "C" {
-    pub fn foo(arg: *mut c_void);
-    pub fn bar(arg: *mut c_void);
+    pub fn foo(arg: *mut libc::c_void);
+    pub fn bar(arg: *mut libc::c_void);
 }
 # fn main() {}
 ```