]> git.lizzy.rs Git - rust.git/commitdiff
Fix fallout from std::libc separation
authorCorey Richardson <corey@octayn.net>
Wed, 26 Feb 2014 17:58:41 +0000 (12:58 -0500)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 4 Apr 2014 16:31:44 +0000 (09:31 -0700)
121 files changed:
mk/crates.mk
src/doc/guide-ffi.md
src/doc/guide-unsafe.md
src/doc/index.md
src/doc/rust.md
src/etc/zsh/_rust
src/libcollections/hashmap.rs
src/libflate/lib.rs
src/libgreen/lib.rs
src/libgreen/macros.rs
src/libgreen/sched.rs
src/libgreen/stack.rs
src/liblibc/lib.rs
src/libnative/io/addrinfo.rs
src/libnative/io/file_unix.rs
src/libnative/io/file_win32.rs
src/libnative/io/mod.rs
src/libnative/io/net.rs
src/libnative/io/pipe_unix.rs
src/libnative/io/pipe_win32.rs
src/libnative/io/process.rs
src/libnative/io/timer_helper.rs
src/libnative/io/timer_other.rs
src/libnative/io/timer_timerfd.rs
src/libnative/io/timer_win32.rs
src/libnative/lib.rs
src/librand/os.rs
src/librustc/back/archive.rs
src/librustc/back/link.rs
src/librustc/back/lto.rs
src/librustc/lib.rs
src/librustc/lib/llvm.rs
src/librustc/middle/astencode.rs
src/librustc/middle/lint.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/cabi_mips.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/type_.rs
src/librustc/middle/trans/value.rs
src/librustdoc/flock.rs
src/librustdoc/html/markdown.rs
src/librustdoc/lib.rs
src/librustuv/addrinfo.rs
src/librustuv/async.rs
src/librustuv/file.rs
src/librustuv/idle.rs
src/librustuv/lib.rs
src/librustuv/macros.rs
src/librustuv/net.rs
src/librustuv/pipe.rs
src/librustuv/process.rs
src/librustuv/queue.rs
src/librustuv/signal.rs
src/librustuv/stream.rs
src/librustuv/timer.rs
src/librustuv/tty.rs
src/librustuv/uvio.rs
src/librustuv/uvll.rs
src/libstd/c_str.rs
src/libstd/io/pipe.rs
src/libstd/os.rs
src/libsyntax/diagnostic.rs
src/libtime/lib.rs
src/test/auxiliary/anon-extern-mod-cross-crate-1.rs
src/test/auxiliary/extern-crosscrate-source.rs
src/test/auxiliary/foreign_lib.rs
src/test/auxiliary/issue-3012-1.rs
src/test/auxiliary/issue_5844_aux.rs
src/test/compile-fail/attrs-after-extern-mod.rs
src/test/compile-fail/lint-ctypes.rs
src/test/compile-fail/lint-dead-code-3.rs
src/test/compile-fail/non-copyable-void.rs
src/test/compile-fail/static-mut-foreign-requires-unsafe.rs
src/test/compile-fail/unsupported-cast.rs
src/test/run-fail/extern-fail.rs
src/test/run-fail/morestack2.rs
src/test/run-pass/anon-extern-mod.rs
src/test/run-pass/c-stack-as-value.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/const-cast.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/extern-call-deep.rs
src/test/run-pass/extern-call-deep2.rs
src/test/run-pass/extern-call-indirect.rs
src/test/run-pass/extern-call-scrub.rs
src/test/run-pass/extern-stress.rs
src/test/run-pass/extern-yield.rs
src/test/run-pass/foreign-call-no-runtime.rs
src/test/run-pass/foreign-dupe.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/foreign-mod-unused-const.rs
src/test/run-pass/foreign-no-abi.rs
src/test/run-pass/foreign2.rs
src/test/run-pass/issue-1251.rs
src/test/run-pass/issue-2214.rs
src/test/run-pass/issue-3012-2.rs
src/test/run-pass/issue-3656.rs
src/test/run-pass/issue-4735.rs
src/test/run-pass/issue-5791.rs
src/test/run-pass/item-attributes.rs
src/test/run-pass/lint-cstack.rs
src/test/run-pass/morestack6.rs
src/test/run-pass/newtype-struct-with-dtor.rs
src/test/run-pass/osx-frameworks.rs
src/test/run-pass/process-detach.rs
src/test/run-pass/regions-mock-tcx.rs
src/test/run-pass/regions-mock-trans.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/static-mut-foreign.rs
src/test/run-pass/supported-cast.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/variadic-ffi.rs

index 89ea98e801419eb0700c7e0fdd2b6b645bef06d7..28330010dc2acc6c3939498c7b991687c4480a1c 100644 (file)
 # automatically generated for all stage/host/target combinations.
 ################################################################################
 
-TARGET_CRATES := std green rustuv native flate arena glob term semver \
+TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
                  uuid serialize sync getopts collections num test time rand \
                 workcache url log
 HOST_CRATES := syntax rustc rustdoc fourcc hexfloat
 CRATES := $(TARGET_CRATES) $(HOST_CRATES)
 TOOLS := compiletest rustdoc rustc
 
-DEPS_std := native:rustrt native:compiler-rt native:backtrace
+DEPS_std := libc native:rustrt native:compiler-rt native:backtrace
 DEPS_green := std rand native:context_switch
 DEPS_rustuv := std native:uv native:uv_support
 DEPS_native := std
index ee7c4064dd4d47f5895afe425f0cadfccbe740d0..449c3ca6941dcfa0d1c88248ed554865ec645869 100644 (file)
@@ -12,7 +12,8 @@ The following is a minimal example of calling a foreign function which will
 compile if snappy is installed:
 
 ~~~~ {.ignore}
-use std::libc::size_t;
+extern crate libc;
+use libc::size_t;
 
 #[link(name = "snappy")]
 extern {
@@ -44,7 +45,8 @@ keeping the binding correct at runtime.
 The `extern` block can be extended to cover the entire snappy API:
 
 ~~~~ {.ignore}
-use std::libc::{c_int, size_t};
+extern crate libc;
+use libc::{c_int, size_t};
 
 #[link(name = "snappy")]
 extern {
@@ -402,7 +404,7 @@ global state. In order to access these variables, you declare them in `extern`
 blocks with the `static` keyword:
 
 ~~~{.ignore}
-use std::libc;
+extern crate libc;
 
 #[link(name = "readline")]
 extern {
@@ -420,7 +422,7 @@ interface. To do this, statics can be declared with `mut` so rust can mutate
 them.
 
 ~~~{.ignore}
-use std::libc;
+extern crate libc;
 use std::ptr;
 
 #[link(name = "readline")]
@@ -444,11 +446,15 @@ calling foreign functions. Some foreign functions, most notably the Windows API,
 conventions. Rust provides a way to tell the compiler which convention to use:
 
 ~~~~
+extern crate libc;
+
 #[cfg(target_os = "win32", target_arch = "x86")]
 #[link(name = "kernel32")]
 extern "stdcall" {
-    fn SetEnvironmentVariableA(n: *u8, v: *u8) -> std::libc::c_int;
+    fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
 }
+
+# fn main() { }
 ~~~~
 
 This applies to the entire `extern` block. The list of supported ABI constraints
index 4c8e32982c10e75c8a84e721e427acb755728524..04b332ab580a20480d897105e57df68c97ad2189 100644 (file)
@@ -192,7 +192,8 @@ As an example, we give a reimplementation of owned boxes by wrapping
 reimplementation is as safe as the built-in `~` type.
 
 ```
-use std::libc::{c_void, size_t, malloc, free};
+extern crate libc;
+use libc::{c_void, size_t, malloc, free};
 use std::mem;
 use std::ptr;
 
index 5bcfd8e8305339cd82efa44bd6704303d2f3386f..efc1847e2c5e74d524becda0b05a650debba0bb9 100644 (file)
@@ -36,6 +36,7 @@ li {list-style-type: none; }
 * [The `glob` file path matching library](glob/index.html)
 * [The `green` M:N runtime library](green/index.html)
 * [The `hexfloat` library for hexadecimal floating-point literals](hexfloat/index.html)
+* [The `libc` bindings](libc/index.html)
 * [The `native` 1:1 threading runtime](native/index.html)
 * [The `num` arbitrary precision numerics library](num/index.html)
 * [The `rand` library for random numbers and distributions](rand/index.html)
index f73b40a3ff47e396edd99216c87f64ce2125ef70..fa43c283082749664beec6e84a54c922a9e81250 100644 (file)
@@ -1472,11 +1472,13 @@ with the exception that they may not have a body
 and are instead terminated by a semicolon.
 
 ~~~~
-# use std::libc::{c_char, FILE};
+extern crate libc;
+use libc::{c_char, FILE};
 
 extern {
     fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
 }
+# fn main() {}
 ~~~~
 
 Functions within external blocks may be called by Rust code,
index f1f9e88f7c92643c270b217f514dbff6dfdc8674..44e2ecc4d3842fbcd1c8dfffb0bce23186f4b650 100644 (file)
@@ -40,7 +40,7 @@ _rustc_opts_switches=(
 )
 _rustc_opts_lint=(
     'attribute-usage[detects bad use of attributes]'
-    'ctypes[proper use of std::libc types in foreign modules]'
+    'ctypes[proper use of libc types in foreign modules]'
     'dead-assignment[detect assignments that will never be read]'
     'dead-code[detect piece of code that will never be used]'
     'default-type-param-usage[prevents explicitly setting a type parameter with a default]'
index 7a51fca6cd5e8c2e869d76482a1d6e665386f027..8090b2cea8c6e1ac87a91fd96125a5d10e952b89 100644 (file)
 use std::slice::ImmutableVector;
 
 mod table {
+    extern crate libc;
+
     use std::clone::Clone;
     use std::cmp::Eq;
     use std::hash::{Hash, Hasher};
     use std::kinds::marker;
-    use std::libc;
     use std::num::CheckedMul;
     use std::option::{Option, Some, None};
     use std::prelude::Drop;
index ddcd8cf46bb6c6008f61d767c1b4213a5f06aa91..97e03561b871500e02840697be04e636c185f300 100644 (file)
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 
-use std::libc::{c_void, size_t, c_int};
-use std::libc;
+extern crate libc;
+
 use std::c_vec::CVec;
+use libc::{c_void, size_t, c_int};
 
-pub mod rustrt {
-    use std::libc::{c_int, c_void, size_t};
 
+pub mod rustrt {
+    use libc::{c_void, size_t, c_int};
     #[link(name = "miniz", kind = "static")]
     extern {
         pub fn tdefl_compress_mem_to_heap(psrc_buf: *c_void,
index 5de8c637cf2034d392015fbfbc3f523cb979bcdd..e4a9641efd1b759c8c1aaf5d92fff1d51f8016ce 100644 (file)
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 #[cfg(test)] extern crate rustuv;
 extern crate rand;
+extern crate libc;
 
 use std::mem::replace;
 use std::os;
index 599ef8d407711ed41c1140cd21d52d0c80f0df15..d1d7a9e0c98da8c54fc5e09ebf8eb98d22baffee 100644 (file)
@@ -52,7 +52,7 @@ macro_rules! rtabort (
 
 pub fn dumb_println(args: &fmt::Arguments) {
     use std::io;
-    use std::libc;
+    use libc;
 
     struct Stderr;
     impl io::Writer for Stderr {
index 683df846d62c2b9ccee2098bbbf8472d567d3c86..036d02655f9f0eab55607fbea5d3b121e147dac7 100644 (file)
@@ -976,7 +976,7 @@ fn new_sched_rng() -> XorShiftRng {
 }
 #[cfg(unix)]
 fn new_sched_rng() -> XorShiftRng {
-    use std::libc;
+    use libc;
     use std::mem;
     use rand::SeedableRng;
 
index 497c1dc664a72a7e537a350c95fc0c557a282482..b8ab4d5f8c1febb8dfa1a3f82a657330aca84ac7 100644 (file)
@@ -11,7 +11,7 @@
 use std::rt::env::max_cached_stacks;
 use std::os::{errno, page_size, MemoryMap, MapReadable, MapWritable,
               MapNonStandardFlags, MapVirtual};
-use std::libc;
+use libc;
 
 /// A task's stack. The name "Stack" is a vestige of segmented stacks.
 pub struct Stack {
index bf2baf95b84f1d9a4405c09af1dbc8bdfe58e826..00aee1d17dcfa3cbb56432b6b2b6b03c8a1c0899 100644 (file)
@@ -8,26 +8,32 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(globs)];
-#[crate_id = "libc#0.10-pre"];
-#[experimental];
+#![feature(globs)]
+#![crate_id = "libc#0.10-pre"]
+#![experimental]
+#![no_std] // we don't need std, and we can't have std, since it doesn't exist
+           // yet. std depends on us.
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
 
 /*!
 * Bindings for the C standard library and other platform libraries
 *
-* This module contains bindings to the C standard library,
-* organized into modules by their defining standard.
-* Additionally, it contains some assorted platform-specific definitions.
-* For convenience, most functions and types are reexported from `libc`,
-* so `pub use std::*` will import the available
-* C bindings as appropriate for the target platform. The exact
-* set of functions available are platform specific.
+* **NOTE:** These are *architecture and libc* specific. On Linux, these
+* bindings are only correct for glibc.
 *
-* *Note* Because these definitions are platform-specific, some may not appear in
-* the generated documentation.
+* This module contains bindings to the C standard library, organized into
+* modules by their defining standard.  Additionally, it contains some assorted
+* platform-specific definitions.  For convenience, most functions and types
+* are reexported, so `use libc::*` will import the available C bindings as
+* appropriate for the target platform. The exact set of functions available
+* are platform specific.
 *
-* We consider the following specs reasonably normative with respect
-* to interoperating with the C standard library (libc/msvcrt):
+* *Note:* Because these definitions are platform-specific, some may not appear
+* in the generated documentation.
+*
+* We consider the following specs reasonably normative with respect to
+* interoperating with the C standard library (libc/msvcrt):
 *
 * * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
 * * ISO 9899:1999 ('C99' or 'C9x').
 * * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
 * * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
 *
-* Note that any reference to the 1996 revision of POSIX, or any revs
-* between 1990 (when '88 was approved at ISO) and 2001 (when the next
-* actual revision-revision happened), are merely additions of other
-* chapters (1b and 1c) outside the core interfaces.
+* Note that any reference to the 1996 revision of POSIX, or any revs between
+* 1990 (when '88 was approved at ISO) and 2001 (when the next actual
+* revision-revision happened), are merely additions of other chapters (1b and
+* 1c) outside the core interfaces.
 *
 * Despite having several names each, these are *reasonably* coherent
 * point-in-time, list-of-definition sorts of specs. You can get each under a
 * sanity while editing, filling-in-details and eliminating duplication) into
 * definitions common-to-all (held in modules named c95, c99, posix88, posix01
 * and posix08) and definitions that appear only on *some* platforms (named
-* 'extra'). This would be things like significant OSX foundation kit, or
-* win32 library kernel32.dll, or various fancy glibc, linux or BSD
-* extensions.
+* 'extra'). This would be things like significant OSX foundation kit, or win32
+* library kernel32.dll, or various fancy glibc, linux or BSD extensions.
 *
 * In addition to the per-platform 'extra' modules, we define a module of
 * 'common BSD' libc routines that never quite made it into POSIX but show up
-* in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the
-* final one from Berkeley after the lawsuits died down and the CSRG
-* dissolved.
+* in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
+* one from Berkeley after the lawsuits died down and the CSRG dissolved.
 */
 
 #![allow(non_camel_case_types)]
@@ -997,7 +1001,6 @@ pub mod posix08 {
             pub mod bsd44 {
             }
             pub mod extra {
-                use ptr;
                 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
                                               WSAPROTOCOL_LEN};
                 use types::common::c95::c_void;
@@ -1102,24 +1105,6 @@ pub struct SYSTEM_INFO {
                 }
                 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
 
-                impl SYSTEM_INFO {
-                    pub fn new() -> SYSTEM_INFO {
-                        SYSTEM_INFO {
-                            wProcessorArchitecture: 0,
-                            wReserved: 0,
-                            dwPageSize: 0,
-                            lpMinimumApplicationAddress: ptr::mut_null(),
-                            lpMaximumApplicationAddress: ptr::mut_null(),
-                            dwActiveProcessorMask: 0,
-                            dwNumberOfProcessors: 0,
-                            dwProcessorType: 0,
-                            dwAllocationGranularity: 0,
-                            wProcessorLevel: 0,
-                            wProcessorRevision: 0
-                        }
-                    }
-                }
-
                 pub struct MEMORY_BASIC_INFORMATION {
                     pub BaseAddress: LPVOID,
                     pub AllocationBase: LPVOID,
@@ -3901,12 +3886,11 @@ pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int)
         pub mod glob {
             use types::os::arch::c95::{c_char, c_int};
             use types::os::common::posix01::{glob_t};
-            use Nullable;
 
             extern {
                 pub fn glob(pattern: *c_char,
                             flags: c_int,
-                            errfunc: Nullable<extern "C" fn(epath: *c_char, errno: int) -> int>,
+                            errfunc: ::Nullable<extern "C" fn(epath: *c_char, errno: int) -> int>,
                             pglob: *mut glob_t);
                 pub fn globfree(pglob: *mut glob_t);
             }
index bca564870e2f63fd784b41a0733b4bc13acfa839..5b872a2dbc5cf26f5fff1290ccdcfb43e30ffb61 100644 (file)
@@ -12,8 +12,8 @@
 use std::c_str::CString;
 use std::cast;
 use std::io::IoError;
-use std::libc;
-use std::libc::{c_char, c_int};
+use libc;
+use libc::{c_char, c_int};
 use std::ptr::{null, mut_null};
 
 use super::net::sockaddr_to_addr;
index 143228b14e9e47581447d67236ac39f01d733fa8..56460166b48a4c7b3cdfbb23f5ec7fb18bccea1a 100644 (file)
@@ -14,8 +14,8 @@
 use std::c_str::CString;
 use std::io::IoError;
 use std::io;
-use std::libc::{c_int, c_void};
-use std::libc;
+use libc::{c_int, c_void};
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::slice;
@@ -341,8 +341,8 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
 }
 
 pub fn readdir(p: &CString) -> IoResult<~[Path]> {
-    use std::libc::{dirent_t};
-    use std::libc::{opendir, readdir_r, closedir};
+    use libc::{dirent_t};
+    use libc::{opendir, readdir_r, closedir};
 
     fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
         let root = unsafe { CString::new(root.with_ref(|p| p), false) };
@@ -520,7 +520,7 @@ pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
 mod tests {
     use super::{CFile, FileDesc};
     use std::io;
-    use std::libc;
+    use libc;
     use std::os;
     use std::rt::rtio::RtioFileStream;
 
index c19e81b5de4571b3057bfe28a9b07047e6759ae2..3e8ee55df94fc934350364a38b1fff61752e33ac 100644 (file)
@@ -14,8 +14,8 @@
 use std::cast;
 use std::io::IoError;
 use std::io;
-use std::libc::{c_int, c_void};
-use std::libc;
+use libc::{c_int, c_void};
+use libc;
 use std::mem;
 use std::os::win32::{as_utf16_p, fill_utf16_buf_and_decode};
 use std::ptr;
index 34843102456bfccfb47121701b3cae7e2e27aae1..ffca0dbe3dc6056890cd6a7eef296882652c5c56 100644 (file)
@@ -27,8 +27,8 @@
 use std::io::net::ip::SocketAddr;
 use std::io::process::ProcessConfig;
 use std::io::signal::Signum;
-use std::libc::c_int;
-use std::libc;
+use libc::c_int;
+use libc;
 use std::os;
 use std::rt::rtio;
 use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioUdpSocket,
index 6ddd69eb019995bfbbef94628a4122214803ace5..cef6a247a00af9024a6ac81c05a5f3fbb784c90a 100644 (file)
@@ -11,7 +11,7 @@
 use std::cast;
 use std::io::net::ip;
 use std::io;
-use std::libc;
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::sync::arc::UnsafeArc;
index fb9ac27d830676f3f5f352cf04a5a831eb7676c8..22ba643e96a0261e1a4ef14d8f51423bb13c36a3 100644 (file)
@@ -11,7 +11,7 @@
 use std::c_str::CString;
 use std::cast;
 use std::io;
-use std::libc;
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::sync::arc::UnsafeArc;
index 36f2dc7d65c7362fe0030d73d501640c50b202fb..84b3d887c04989ebfa618688d035ff82aa97d832 100644 (file)
@@ -85,7 +85,7 @@
 //! me!
 
 use std::c_str::CString;
-use std::libc;
+use libc;
 use std::os::win32::as_utf16_p;
 use std::ptr;
 use std::rt::rtio;
index d2e2db63c1bff7c1276040861091701290295697..1218fab05f03478d23021ec3ad01217f9a9171f9 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 use std::io;
-use std::libc::{pid_t, c_void, c_int};
-use std::libc;
+use libc::{pid_t, c_void, c_int};
+use libc;
 use std::os;
 use std::ptr;
 use std::rt::rtio;
@@ -223,20 +223,20 @@ fn spawn_process_os(config: p::ProcessConfig,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
                     err_fd: c_int) -> IoResult<SpawnProcessResult> {
-    use std::libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
-    use std::libc::consts::os::extra::{
+    use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
+    use libc::consts::os::extra::{
         TRUE, FALSE,
         STARTF_USESTDHANDLES,
         INVALID_HANDLE_VALUE,
         DUPLICATE_SAME_ACCESS
     };
-    use std::libc::funcs::extra::kernel32::{
+    use libc::funcs::extra::kernel32::{
         GetCurrentProcess,
         DuplicateHandle,
         CloseHandle,
         CreateProcessA
     };
-    use std::libc::funcs::extra::msvcrt::get_osfhandle;
+    use libc::funcs::extra::msvcrt::get_osfhandle;
 
     use std::mem;
 
@@ -422,9 +422,9 @@ fn spawn_process_os(config: p::ProcessConfig,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
                     err_fd: c_int) -> IoResult<SpawnProcessResult> {
-    use std::libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
-    use std::libc::funcs::bsd44::getdtablesize;
-    use std::libc::c_ulong;
+    use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
+    use libc::funcs::bsd44::getdtablesize;
+    use libc::c_ulong;
 
     mod rustrt {
         extern {
@@ -716,8 +716,8 @@ fn waitpid(pid: pid_t) -> p::ProcessExit {
 
     #[cfg(windows)]
     fn waitpid_os(pid: pid_t) -> p::ProcessExit {
-        use std::libc::types::os::arch::extra::DWORD;
-        use std::libc::consts::os::extra::{
+        use libc::types::os::arch::extra::DWORD;
+        use libc::consts::os::extra::{
             SYNCHRONIZE,
             PROCESS_QUERY_INFORMATION,
             FALSE,
@@ -725,7 +725,7 @@ fn waitpid_os(pid: pid_t) -> p::ProcessExit {
             INFINITE,
             WAIT_FAILED
         };
-        use std::libc::funcs::extra::kernel32::{
+        use libc::funcs::extra::kernel32::{
             OpenProcess,
             GetExitCodeProcess,
             CloseHandle,
@@ -761,7 +761,7 @@ fn waitpid_os(pid: pid_t) -> p::ProcessExit {
 
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> p::ProcessExit {
-        use std::libc::funcs::posix01::wait;
+        use libc::funcs::posix01::wait;
         let mut status = 0 as c_int;
         match retry(|| unsafe { wait::waitpid(pid, &mut status, 0) }) {
             -1 => fail!("unknown waitpid error: {}", super::last_error()),
@@ -779,7 +779,7 @@ fn waitpid_os(_pid: pid_t) -> Option<p::ProcessExit> { None }
 
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> Option<p::ProcessExit> {
-        use std::libc::funcs::posix01::wait;
+        use libc::funcs::posix01::wait;
         let mut status = 0 as c_int;
         match retry(|| unsafe {
             wait::waitpid(pid, &mut status, libc::WNOHANG)
index e5f70c4e4b31c81698bf18c72cb32305c7d24772..4b29feab84fd0c5e2a0a146d44426a5d7f0b8d41 100644 (file)
@@ -94,7 +94,7 @@ fn shutdown() {
 
 #[cfg(unix)]
 mod imp {
-    use std::libc;
+    use libc;
     use std::os;
 
     use io::file::FileDesc;
@@ -117,9 +117,9 @@ pub fn close(fd: libc::c_int) {
 
 #[cfg(windows)]
 mod imp {
-    use std::libc::{BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
+    use libc::{BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
     use std::ptr;
-    use std::libc;
+    use libc;
 
     pub type signal = HANDLE;
 
index 7979075aa025c174c7cfeff5a701aecbe214c902..13f1ea6319a460fbee5fe88e14f235850f5edecb 100644 (file)
@@ -47,7 +47,7 @@
 //! Note that all time units in this file are in *milliseconds*.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::mem;
 use std::os;
 use std::ptr;
@@ -287,7 +287,7 @@ fn drop(&mut self) {
 
 #[cfg(target_os = "macos")]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static FD_SETSIZE: uint = 1024;
 
@@ -314,7 +314,7 @@ pub fn gettimeofday(timeval: *mut libc::timeval,
 #[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static FD_SETSIZE: uint = 1024;
 
index d7202d9d765d425dc5dea8d78a4ffef7748b2f90..25dbdc1e1a5cdf8f67abdd31dc703b9430e22d75 100644 (file)
@@ -29,7 +29,7 @@
 //! As with timer_other, all units in this file are in units of millseconds.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::ptr;
 use std::os;
 use std::rt::rtio;
@@ -267,7 +267,7 @@ fn drop(&mut self) {
 
 #[allow(dead_code)]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static CLOCK_MONOTONIC: libc::c_int = 1;
     pub static EPOLL_CTL_ADD: libc::c_int = 1;
index 3e420e4544887bdf2e467290021627932c45f3e0..278a5a73a36bd5943ac2462bb8cb8c1e945aae13 100644 (file)
@@ -21,7 +21,7 @@
 //! the other two implementations of timers with nothing *that* new showing up.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::ptr;
 use std::rt::rtio;
 
@@ -178,7 +178,7 @@ fn drop(&mut self) {
 }
 
 mod imp {
-    use std::libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
+    use libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
                     LONG, LPVOID, DWORD, c_void};
 
     pub type PTIMERAPCROUTINE = *c_void;
index 8afbbda71c27ea5ec399b26c6a602aef0d421f4f..b4e8bfde4894578fc51d54ec1ff5121098327992 100644 (file)
@@ -57,6 +57,8 @@
 //    consider whether they're needed before adding that feature here (the
 //    answer is that you don't need them)
 
+extern crate libc;
+
 use std::os;
 use std::rt;
 use std::str;
@@ -109,8 +111,8 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
     // prevent this problem.
     #[cfg(windows)] fn ignore_sigpipe() {}
     #[cfg(unix)] fn ignore_sigpipe() {
-        use std::libc;
-        use std::libc::funcs::posix01::signal::signal;
+        use libc;
+        use libc::funcs::posix01::signal::signal;
         unsafe {
             assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != -1);
         }
index 762e09fb3f51130efc0aaad3cf4478a6cbf7902c..ed4c7299dffb8d4614666d9b4eccd50339b45450 100644 (file)
@@ -58,12 +58,14 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
 
 #[cfg(windows)]
 mod imp {
+    extern crate libc;
+
     use Rng;
     use std::cast;
     use std::io::{IoResult, IoError};
-    use std::libc::{c_ulong, DWORD, BYTE, LPCSTR, BOOL};
     use std::os;
     use std::rt::stack;
+    use self::libc::{c_ulong, DWORD, BYTE, LPCSTR, BOOL};
 
     type HCRYPTPROV = c_ulong;
 
index 6de7bb59b6180ea82ee96d0bf6881d7154a47b9f..0e28791539ce5a8f9e07cd825a204d3b04568550 100644 (file)
@@ -18,7 +18,7 @@
 use std::cast;
 use std::io;
 use std::io::{fs, TempDir};
-use std::libc;
+use libc;
 use std::os;
 use std::io::process::{ProcessConfig, Process, ProcessOutput};
 use std::str;
index e9292f54a4b266f6c7c27152f130d44596087416..a329f850ed40ca149d9dafd66701cc5b222d2350 100644 (file)
@@ -102,7 +102,7 @@ pub mod write {
 
     use std::c_str::ToCStr;
     use std::io::Process;
-    use std::libc::{c_uint, c_int};
+    use libc::{c_uint, c_int};
     use std::str;
 
     // On android, we by default compile for armv7 processors. This enables
index 674f5e77cc084135b1720426331fb73201437c1b..3171114985e1f64fefbdc8b903fbe80b4b971d68 100644 (file)
@@ -15,7 +15,7 @@
 use metadata::cstore;
 use util::common::time;
 
-use std::libc;
+use libc;
 use flate;
 
 pub fn run(sess: &session::Session, llmod: ModuleRef,
index cf653f816ac7b7493f2e9bb10704bad5b5d64a84..d18a70523d9f88115b77bf5158251cc79f108eee 100644 (file)
@@ -42,6 +42,8 @@
 extern crate getopts;
 extern crate collections;
 extern crate time;
+extern crate libc;
+
 #[phase(syntax, link)]
 extern crate log;
 
index 9cfe064ad986f9ee63225cf1fd7e73e2f6f0b1bc..62c14e560e79843079153341c560c6f1ce60d5fa 100644 (file)
@@ -15,7 +15,7 @@
 use std::c_str::ToCStr;
 use std::cell::RefCell;
 use collections::HashMap;
-use std::libc::{c_uint, c_ushort, c_void, free};
+use libc::{c_uint, c_ushort, c_void, free};
 use std::str::raw::from_c_str;
 
 use middle::trans::type_::Type;
@@ -307,7 +307,7 @@ pub mod llvm {
     use super::{ValueRef, TargetMachineRef, FileType, ArchiveRef};
     use super::{CodeGenModel, RelocMode, CodeGenOptLevel};
     use super::debuginfo::*;
-    use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
+    use libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
                     size_t};
 
     // Link to our native llvm bindings (things that we need to use the C++ api
index e6f6a87be4fdcc41db014e2a242ea4bf3adb5840..3529f2c57c0e29ea801e44ffb88d743e179151a5 100644 (file)
@@ -34,7 +34,7 @@
 use syntax::parse::token;
 use syntax;
 
-use std::libc;
+use libc;
 use std::cast;
 use std::cell::RefCell;
 use std::io::Seek;
index da74d0c7729e6f1727076a835132c58db21efcc6..22182d7e87e13bcda571bb26db21eefbaee20945 100644 (file)
@@ -154,7 +154,7 @@ enum LintSource {
     ("ctypes",
      LintSpec {
         lint: CTypes,
-        desc: "proper use of std::libc types in foreign modules",
+        desc: "proper use of libc types in foreign modules",
         default: warn
      }),
 
index b42721b754b54f788f47c0f548871c6cbd9dc62a..da78b650852e81ff80d49e52bae35820d2c46e6f 100644 (file)
@@ -44,7 +44,7 @@
  */
 
 use std::container::Map;
-use std::libc::c_ulonglong;
+use libc::c_ulonglong;
 use std::option::{Option, Some, None};
 use std::num::{Bitwise};
 
index 09bbb95fdd04e29ca825434ff1d3c9b8abe245c3..10cd58691466baa4143e3d1f5563420072e4682d 100644 (file)
@@ -72,9 +72,9 @@
 use util::nodemap::NodeMap;
 
 use arena::TypedArena;
+use libc::c_uint;
 use std::c_str::ToCStr;
 use std::cell::{Cell, RefCell};
-use std::libc::c_uint;
 use std::local_data;
 use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
 use syntax::ast_util::{local_def, is_local};
index f40a9ede8622e268c916faa2506bf8f85c0399e9..c60a1e219d009c3a2b291a871a8e02e59a3cba0c 100644 (file)
@@ -21,7 +21,7 @@
 use middle::trans::builder::Builder;
 use middle::trans::type_::Type;
 
-use std::libc::{c_uint, c_ulonglong, c_char};
+use libc::{c_uint, c_ulonglong, c_char};
 
 pub fn terminate(cx: &Block, _: &str) {
     debug!("terminate({})", cx.to_str());
index 07017de2bc2bcd1dadf67c5882860ccc95385f30..b7a18a275cab604d08b5fbaad183f21b82a49b53 100644 (file)
@@ -19,9 +19,9 @@
 use middle::trans::common::*;
 use middle::trans::machine::llalign_of_pref;
 use middle::trans::type_::Type;
-
 use collections::HashMap;
-use std::libc::{c_uint, c_ulonglong, c_char};
+use std::vec::Vec;
+use libc::{c_uint, c_ulonglong, c_char};
 use syntax::codemap::Span;
 
 pub struct Builder<'a> {
index cbcecb2220dc005695424ec86298d4c526fb89b9..395bc637aada086672c156641fa65d04a158ce2e 100644 (file)
@@ -10,7 +10,7 @@
 
 #![allow(non_uppercase_pattern_statics)]
 
-use std::libc::c_uint;
+use libc::c_uint;
 use std::cmp;
 use lib::llvm::{llvm, Integer, Pointer, Float, Double, Struct, Array};
 use lib::llvm::StructRetAttribute;
index 97638f7e4690ab6b2e13ca0b055a00e745a1357b..9008e9ed8dffd57817ee38bb08918bbe26970c53 100644 (file)
 
 use arena::TypedArena;
 use collections::HashMap;
+use libc::{c_uint, c_longlong, c_ulonglong, c_char};
 use std::c_str::ToCStr;
 use std::cell::{Cell, RefCell};
-use std::libc::{c_uint, c_longlong, c_ulonglong, c_char};
+use std::vec::Vec;
 use syntax::ast::Ident;
 use syntax::ast;
 use syntax::ast_map::{PathElem, PathName};
index 6aaae564fdf6d4a1f4f415263d31ad28f6a5d74a..13fb644eedb1c1182592dd0548a88c72d8fd8e8b 100644 (file)
@@ -33,9 +33,9 @@
 use util::ppaux::{Repr, ty_to_str};
 
 use std::c_str::ToCStr;
-use std::libc::c_uint;
 use std::slice;
 use std::vec::Vec;
+use libc::c_uint;
 use syntax::{ast, ast_util};
 
 pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
index ea2c6e7b10122b83ce886fdaa495eb3ff3c2fd72..f98a77eed65a004ce886ba8fcfd29c63f3bfd818 100644 (file)
@@ -27,7 +27,6 @@
 use util::sha2::Sha256;
 use util::nodemap::{NodeMap, NodeSet, DefIdMap};
 
-use libc::c_uint;
 use std::cell::{Cell, RefCell};
 use std::c_str::ToCStr;
 use std::ptr;
index df4598c03072c704e36c37cab9525f7a7f262a74..103fae91e757f201ec6daa9cc7c94faf1e3dc731 100644 (file)
@@ -145,7 +145,7 @@ struct List {
 use std::cell::{Cell, RefCell};
 use collections::HashMap;
 use collections::HashSet;
-use std::libc::{c_uint, c_ulonglong, c_longlong};
+use libc::{c_uint, c_ulonglong, c_longlong};
 use std::ptr;
 use std::sync::atomics;
 use std::slice;
index e70d7bf7568a8880773e9b0f1431b1fd654d5308..0a2bf60bf04e237116844da90fe724330d20741c 100644 (file)
@@ -26,7 +26,7 @@
 use middle::ty::FnSig;
 use middle::ty;
 use std::cmp;
-use std::libc::c_uint;
+use libc::c_uint;
 use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
 use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall, System};
 use syntax::codemap::Span;
index da9d06b9a752613940d9a056bef6246e562eb361..957db7591994775b9f6eb71ccf286b3c8af28fe5 100644 (file)
@@ -38,7 +38,7 @@
 use arena::TypedArena;
 use std::c_str::ToCStr;
 use std::cell::Cell;
-use std::libc::c_uint;
+use libc::c_uint;
 use syntax::ast;
 use syntax::parse::token;
 
index e73ef639a0ba86bec68f32eb78aeab28f1e83bc1..f1f8a1abb2a620954dd3a54f43907bf0f9ae8cc6 100644 (file)
@@ -26,7 +26,7 @@
 use util::ppaux::ty_to_str;
 
 use arena::TypedArena;
-use std::libc::c_uint;
+use libc::c_uint;
 use syntax::ast::DefId;
 use syntax::ast;
 use syntax::ast_map;
index 55ffa951cf2d7f62b45d81d50db571c9e2a914b4..6f91ec53419e07943687099da8ba218e09799366 100644 (file)
@@ -21,7 +21,7 @@
 use std::c_str::ToCStr;
 use std::cast;
 
-use std::libc::{c_uint};
+use libc::{c_uint};
 
 #[deriving(Clone, Eq, Show)]
 pub struct Type {
index 1efb47ad42fb5bc0daa36bf80d640e90b1aca651..e627b859f4295d91a8c093480a4a4fc2467e9c2c 100644 (file)
@@ -11,7 +11,7 @@
 use lib::llvm::{llvm, UseRef, ValueRef};
 use middle::trans::basic_block::BasicBlock;
 use middle::trans::common::Block;
-use std::libc::c_uint;
+use libc::c_uint;
 
 pub struct Value(pub ValueRef);
 
index 9030caed6cd246404d1458bcca638a86a992812d..76341d21e9ac6395e421c87fdfddf849fd3f883d 100644 (file)
 
 pub use self::imp::Lock;
 
+
 #[cfg(unix)]
 mod imp {
-    use std::libc;
+    use libc;
 
     #[cfg(target_os = "linux")]
     mod os {
-        use std::libc;
+        use libc;
 
         pub struct flock {
             pub l_type: libc::c_short,
@@ -45,7 +46,7 @@ pub struct flock {
 
     #[cfg(target_os = "freebsd")]
     mod os {
-        use std::libc;
+        use libc;
 
         pub struct flock {
             pub l_start: libc::off_t,
@@ -64,7 +65,7 @@ pub struct flock {
 
     #[cfg(target_os = "macos")]
     mod os {
-        use std::libc;
+        use libc;
 
         pub struct flock {
             pub l_start: libc::off_t,
@@ -132,7 +133,7 @@ fn drop(&mut self) {
 
 #[cfg(windows)]
 mod imp {
-    use std::libc;
+    use libc;
     use std::mem;
     use std::os::win32::as_utf16_p;
     use std::os;
index ff2462cfb22ba28f526dc2f3182fc398cebd350a..8449d5ff1d8928b23d0514803c4662abddf7a89c 100644 (file)
 
 #![allow(non_camel_case_types)]
 
+use libc;
 use std::cast;
 use std::fmt;
 use std::io;
-use std::libc;
 use std::local_data;
 use std::mem;
 use std::str;
index 5e53632dbba55b75ca0ad31b998c24d4801eeea1..7059d7fb8a373ad731cc98e8de481dc41a63f6a2 100644 (file)
@@ -26,6 +26,7 @@
 extern crate time;
 #[phase(syntax, link)]
 extern crate log;
+extern crate libc;
 
 use std::local_data;
 use std::io;
index 5d6af2969b8b3ba21434ed72f589e26bd103e234..7a23a3466da4011d3765939939b2184bc70e61fa 100644 (file)
@@ -10,8 +10,8 @@
 
 use ai = std::io::net::addrinfo;
 use std::cast;
-use std::libc;
-use std::libc::c_int;
+use libc;
+use libc::c_int;
 use std::ptr::null;
 use std::rt::task::BlockedTask;
 
index 5caccb348cc798fa4a9bb91cc802609c0f9ed2ae..c75f84de01e4462ffeb874d2ac8e644e47174781 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::cast;
-use std::libc::c_int;
+use libc::c_int;
 use std::rt::rtio::{Callback, RemoteCallback};
 use std::unstable::sync::Exclusive;
 
index 93cc1d8d54f141ce37ef5a2d55a9861994c54742..acb7a8184dd0782da034d1281735a33d1c9a72ec 100644 (file)
@@ -12,8 +12,8 @@
 use std::c_str;
 use std::cast::transmute;
 use std::cast;
-use std::libc::{c_int, c_char, c_void, size_t, ssize_t};
-use std::libc;
+use libc::{c_int, c_char, c_void, size_t, ssize_t};
+use libc;
 use std::rt::task::BlockedTask;
 use std::io::{FileStat, IoError};
 use std::io;
@@ -434,7 +434,7 @@ fn pwrite(&mut self, buf: &[u8], offset: u64) -> Result<(), IoError> {
         self.base_write(buf, offset as i64)
     }
     fn seek(&mut self, pos: i64, whence: io::SeekStyle) -> Result<u64, IoError> {
-        use std::libc::{SEEK_SET, SEEK_CUR, SEEK_END};
+        use libc::{SEEK_SET, SEEK_CUR, SEEK_END};
         let whence = match whence {
             io::SeekSet => SEEK_SET,
             io::SeekCur => SEEK_CUR,
@@ -443,7 +443,7 @@ fn seek(&mut self, pos: i64, whence: io::SeekStyle) -> Result<u64, IoError> {
         self.seek_common(pos, whence)
     }
     fn tell(&self) -> Result<u64, IoError> {
-        use std::libc::SEEK_CUR;
+        use libc::SEEK_CUR;
         // this is temporary
         let self_ = unsafe { cast::transmute_mut(self) };
         self_.seek_common(0, SEEK_CUR)
@@ -465,8 +465,8 @@ fn truncate(&mut self, offset: i64) -> Result<(), IoError> {
 
 #[cfg(test)]
 mod test {
-    use std::libc::c_int;
-    use std::libc::{O_CREAT, O_RDWR, O_RDONLY, S_IWUSR, S_IRUSR};
+    use libc::c_int;
+    use libc::{O_CREAT, O_RDWR, O_RDONLY, S_IWUSR, S_IRUSR};
     use std::io;
     use std::str;
     use std::slice;
index bbfacf870964c61f4e14c02edb869927a7b34f96..0de6e479a8f7aacb54414f2e8d75c8ae137096d3 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::cast;
-use std::libc::{c_int, c_void};
+use libc::{c_int, c_void};
 
 use uvll;
 use super::{Loop, UvHandle};
index 22cb82926375013e4d31555508be4b89e0e55774..8f5d4a725140aa53de1b5493e325365a747d05c1 100644 (file)
 
 #[cfg(test)] extern crate green;
 #[cfg(test)] extern crate realrustuv = "rustuv";
+extern crate libc;
 
 use std::cast;
 use std::fmt;
 use std::io::IoError;
 use std::io;
-use std::libc::{c_int, c_void};
+use libc::{c_int, c_void};
 use std::ptr::null;
 use std::ptr;
 use std::rt::local::Local;
index a51b842f139706e732c0dd58040b791233b05c58..df41adfafbece95382607dc298f661697d9f7077 100644 (file)
@@ -29,7 +29,7 @@ macro_rules! uvdebug (
 
 pub fn dumb_println(args: &fmt::Arguments) {
     use std::io;
-    use std::libc;
+    use libc;
 
     struct Stderr;
     impl io::Writer for Stderr {
index a6d1e1a6efdba84e279154ad50c72fe99eb3790e..4d4b62dddd4a0642cc986db228cb9bdb1f7c2e99 100644 (file)
@@ -11,8 +11,8 @@
 use std::cast;
 use std::io::IoError;
 use std::io::net::ip;
-use std::libc::{size_t, ssize_t, c_int, c_void, c_uint};
-use std::libc;
+use libc::{size_t, ssize_t, c_int, c_void, c_uint};
+use libc;
 use std::mem;
 use std::ptr;
 use std::rt::rtio;
index ea46c3a129678e80b527945eaf3bea40853eab20..dd11fb90a524894a2c4fd7cdd69c45e1f6e5402f 100644 (file)
@@ -10,7 +10,7 @@
 
 use std::c_str::CString;
 use std::io::IoError;
-use std::libc;
+use libc;
 use std::rt::rtio::{RtioPipe, RtioUnixListener, RtioUnixAcceptor};
 use std::rt::task::BlockedTask;
 
index bd07bf18a72d06b7d03c4729601b847eb75a46b3..c0db66cb913fd1e6f7fa7df4d81529970ca821e7 100644 (file)
@@ -10,8 +10,8 @@
 
 use std::io::IoError;
 use std::io::process;
-use std::libc::c_int;
-use std::libc;
+use libc::c_int;
+use libc;
 use std::ptr;
 use std::rt::rtio::RtioProcess;
 use std::rt::task::BlockedTask;
index f5643e80f4a08466bbc667e3a543405d14500e9e..b6c7fbda8c836c2ba26417702741291c4c0b40ef 100644 (file)
@@ -21,7 +21,7 @@
 #![allow(dead_code)]
 
 use std::cast;
-use std::libc::{c_void, c_int};
+use libc::{c_void, c_int};
 use std::rt::task::BlockedTask;
 use std::unstable::mutex::NativeMutex;
 use std::sync::arc::UnsafeArc;
index 25cc8b8a8fbe8cf3453e4311e158a511ec22b290..c38b4fdd96faf8d1680fe9e83ba6e335ec76c8a2 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc::c_int;
+use libc::c_int;
 use std::io::signal::Signum;
 use std::rt::rtio::RtioSignal;
 
index 10d62a5aeae055639a9a66480ff7e2b4674e7ae4..1fb61c15b830b11addcd0ce15e6e6969287f3f42 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::cast;
-use std::libc::{c_int, size_t, ssize_t};
+use libc::{c_int, size_t, ssize_t};
 use std::ptr;
 use std::rt::task::BlockedTask;
 
index 6cbba8e6fd452eaea47dec7f19d2498baaac6836..3d323382ad5368abf2aca5a34ed94a0be9924ad4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc::c_int;
+use libc::c_int;
 use std::mem;
 use std::rt::rtio::RtioTimer;
 use std::rt::task::BlockedTask;
index 19c98c79b6abd9828baa4115ce833cb9b5906b80..95ecaa09a43ae473ddf3b2e49697f3b0dbf4e1ac 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use libc;
 use std::io::IoError;
-use std::libc;
 use std::ptr;
 use std::rt::rtio::RtioTTY;
 
index d8365cf677c173f2af308ef905c3db0f797c9c9f..424849bbf0eab83d37da97c044628fabaff79a34 100644 (file)
 use std::io::{FileMode, FileAccess, Open, Append, Truncate, Read, Write,
               ReadWrite, FileStat};
 use std::io;
-use std::libc::c_int;
-use std::libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY, S_IRUSR,
+use libc::c_int;
+use libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY, S_IRUSR,
                 S_IWUSR};
-use std::libc;
+use libc;
 use std::path::Path;
 use std::rt::rtio;
 use std::rt::rtio::IoFactory;
index 62f1dbd73e3327c7c8a8798c144f9c79367581db..04bc53004d04c1e8e4b2708b18418113bc69f817 100644 (file)
 
 #![allow(non_camel_case_types)] // C types
 
-use std::libc::{size_t, c_int, c_uint, c_void, c_char, c_double};
-use std::libc::{ssize_t, sockaddr, free, addrinfo};
-use std::libc;
+use libc::{size_t, c_int, c_uint, c_void, c_char, c_double};
+use libc::{ssize_t, sockaddr, free, addrinfo};
+use libc;
 use std::rt::global_heap::malloc_raw;
 
 #[cfg(test)]
-use std::libc::uintptr_t;
+use libc::uintptr_t;
 
 pub use self::errors::{EACCES, ECONNREFUSED, ECONNRESET, EPIPE, ECONNABORTED,
                        ECANCELED, EBADF, ENOTCONN, ENOENT, EADDRNOTAVAIL};
@@ -49,7 +49,7 @@
 
 #[cfg(windows)]
 pub mod errors {
-    use std::libc::c_int;
+    use libc::c_int;
 
     pub static EACCES: c_int = -4092;
     pub static ECONNREFUSED: c_int = -4078;
@@ -64,8 +64,8 @@ pub mod errors {
 }
 #[cfg(not(windows))]
 pub mod errors {
-    use std::libc;
-    use std::libc::c_int;
+    use libc;
+    use libc::c_int;
 
     pub static EACCES: c_int = -libc::EACCES;
     pub static ECONNREFUSED: c_int = -libc::ECONNREFUSED;
index ca1a05a264743676f83b90db6e528f7f9379cf6b..6acf0eb0cee596168e2cfbbeecf5a03f5ec56e57 100644 (file)
 An example of creating and using a C string would be:
 
 ```rust
-use std::libc;
+extern crate libc;
+
 extern {
     fn puts(s: *libc::c_char);
 }
 
-let my_string = "Hello, world!";
-
-// Allocate the C string with an explicit local that owns the string. The
-// `c_buffer` pointer will be deallocated when `my_c_string` goes out of scope.
-let my_c_string = my_string.to_c_str();
-my_c_string.with_ref(|c_buffer| {
-    unsafe { puts(c_buffer); }
-});
-
-// Don't save off the allocation of the C string, the `c_buffer` will be
-// deallocated when this block returns!
-my_string.with_c_str(|c_buffer| {
-    unsafe { puts(c_buffer); }
-});
+fn main() {
+    let my_string = "Hello, world!";
+
+    // Allocate the C string with an explicit local that owns the string. The
+    // `c_buffer` pointer will be deallocated when `my_c_string` goes out of scope.
+    let my_c_string = my_string.to_c_str();
+    my_c_string.with_ref(|c_buffer| {
+        unsafe { puts(c_buffer); }
+    });
+
+    // Don't save off the allocation of the C string, the `c_buffer` will be
+    // deallocated when this block returns!
+    my_string.with_c_str(|c_buffer| {
+        unsafe { puts(c_buffer); }
+    });
+}
  ```
 
 */
@@ -266,11 +269,13 @@ pub trait ToCStr {
     /// # Example
     ///
     /// ```rust
-    /// use std::libc;
+    /// extern crate libc;
     ///
-    /// let s = "PATH".with_c_str(|path| unsafe {
-    ///     libc::getenv(path)
-    /// });
+    /// fn main() {
+    ///     let s = "PATH".with_c_str(|path| unsafe {
+    ///         libc::getenv(path)
+    ///     });
+    /// }
     /// ```
     ///
     /// # Failure
index 75ec3d8614e8293ab150ba5c2fc2891afff7bffb..6eff453b60dba756a01815549dfdbc2038278d24 100644 (file)
@@ -38,11 +38,14 @@ impl PipeStream {
     ///
     /// ```rust
     /// # #[allow(unused_must_use)];
-    /// use std::libc;
+    /// extern crate libc;
+    ///
     /// use std::io::pipe::PipeStream;
     ///
-    /// let mut pipe = PipeStream::open(libc::STDERR_FILENO);
-    /// pipe.write(bytes!("Hello, stderr!"));
+    /// fn main() {
+    ///     let mut pipe = PipeStream::open(libc::STDERR_FILENO);
+    ///     pipe.write(bytes!("Hello, stderr!"));
+    /// }
     /// ```
     pub fn open(fd: libc::c_int) -> IoResult<PipeStream> {
         LocalIo::maybe_raise(|io| {
index a5583afb31dde25edb1e0585ae6332df8ef18fcb..a16113cb48fce25bd7d134b47a7801a83a28fcb6 100644 (file)
@@ -932,8 +932,9 @@ pub fn page_size() -> uint {
 /// Returns the page size of the current architecture in bytes.
 #[cfg(windows)]
 pub fn page_size() -> uint {
+    use mem;
     unsafe {
-        let mut info = libc::SYSTEM_INFO::new();
+        let mut info = mem::uninit();
         libc::GetSystemInfo(&mut info);
 
         return info.dwPageSize as uint;
@@ -1250,8 +1251,9 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
     /// Granularity of MapAddr() and MapOffset() parameter values.
     /// This may be greater than the value returned by page_size().
     pub fn granularity() -> uint {
+        use mem;
         unsafe {
-            let mut info = libc::SYSTEM_INFO::new();
+            let mut info = mem::uninit();
             libc::GetSystemInfo(&mut info);
 
             return info.dwAllocationGranularity as uint;
index fb0f458b88a2bbb05e4e2100cd0e20a66af4b2c1..943ae16b48fb92e57f73ef695edf8a651fc949cc 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate libc;
+
 use codemap::{Pos, Span};
 use codemap;
 
index f3398942575a78aadae6c7bf7a5f696623f5b2e8..23ffb7813ba2d99e830ce668b7fb512c2e99a0da 100644 (file)
@@ -20,9 +20,9 @@
 
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 extern crate serialize;
+extern crate libc;
 
 use std::io::BufReader;
-use std::libc;
 use std::num;
 use std::str;
 
@@ -42,7 +42,7 @@ mod rustrt {
 
 #[cfg(unix, not(target_os = "macos"))]
 mod imp {
-    use std::libc::{c_int, timespec};
+    use libc::{c_int, timespec};
 
     // Apparently android provides this in some other library?
     #[cfg(not(target_os = "android"))]
@@ -56,7 +56,7 @@ mod imp {
 }
 #[cfg(target_os = "macos")]
 mod imp {
-    use std::libc::{timeval, timezone, c_int, mach_timebase_info};
+    use libc::{timeval, timezone, c_int, mach_timebase_info};
 
     extern {
         pub fn gettimeofday(tp: *mut timeval, tzp: *mut timezone) -> c_int;
@@ -1076,7 +1076,7 @@ mod tests {
 
     #[cfg(windows)]
     fn set_time_zone() {
-        use std::libc;
+        use libc;
         // Windows crt doesn't see any environment variable set by
         // `SetEnvironmentVariable`, which `os::setenv` internally uses.
         // It is why we use `putenv` here.
index aa6ee35a077925027e494cabdfb9c3364adf67d0..fe4a397b786afc21c05f1228b33e8dad33e48792 100644 (file)
@@ -10,7 +10,7 @@
 
 #[crate_id="anonexternmod#0.1"];
 
-use std::libc;
+extern crate libc;
 
 #[link(name="rustrt")]
 extern {
index d2c79bbe9cb2dc44ede7f153a1e0373b00d2c280..7185ac413c5d119e1521007f7888975924292978 100644 (file)
 #[crate_id="externcallback#0.1"];
 #[crate_type = "lib"];
 
-use std::libc;
+extern crate libc;
 
 pub mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index e59fae346368b8bd2aaee5b6983753a808983c93..396e136f6f030bfa985fba28b6c60251ea66c537 100644 (file)
@@ -11,7 +11,7 @@
 #[crate_id="foreign_lib"];
 
 pub mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index af83c5561db8ef8fcccadd841c1bf70304f71323..9bb47fcfad3b40b0047003367ff6e0c51735b34b 100644 (file)
@@ -12,7 +12,7 @@
 #[crate_type = "lib"];
 
 pub mod socket {
-    use std::libc;
+    extern crate libc;
 
     pub struct socket_handle {
         sockfd: libc::c_int,
index 78e87f32b79b33441d9379a3333768b8e76818a8..0f898ae83859f1dbf42993d3b3cb5df764ecd9e5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 extern "C" {
     pub fn rand() -> libc::c_int;
index 44b6ecdee7073a6f5a2129dcc058b413ac75bc1a..df747618696087bca17f937437f87654afc5b140 100644 (file)
@@ -12,7 +12,7 @@
 // statics cannot. This ensures that there's some form of error if this is
 // attempted.
 
-use std::libc;
+extern crate libc;
 
 extern {
     static mut rust_dbg_static_mut: libc::c_int;
index 352a31cf67b2d230100dc9b210abe0b59453a077..3de0a0446d80d545e0a3f028f827794376e68e5b 100644 (file)
@@ -10,7 +10,7 @@
 
 #![deny(ctypes)]
 
-use std::libc;
+extern crate libc;
 
 extern {
     pub fn bare_type1(size: int); //~ ERROR: found rust type
index 7c8a4c2a22cc2818948a61a6ce43f7924923d513..95c1d131b7b2d082bad29fd674ec289a61c9e360 100644 (file)
@@ -14,6 +14,8 @@
 
 #![crate_type="lib"]
 
+extern crate libc;
+
 struct Foo; //~ ERROR: code is never used
 impl Foo {
     fn foo(&self) { //~ ERROR: code is never used
@@ -46,7 +48,7 @@ pub fn pub_fn() {
 }
 
 mod blah {
-    use std::libc::size_t;
+    use libc::size_t;
     // not warned because it's used in the parameter of `free` and return of
     // `malloc` below, which are also used.
     enum c_void {}
index bd9547d5e1c4af74d1e38e4bffe1ec8c1b52c496..5025e2e509b116878c9e74472761b9b8c3b6520a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 fn main() {
     let x : *Vec<int> = &vec!(1,2,3);
index 7b371cf708dc1af76df0858c66a0b85271defd56..0e44af19a7f627b597d605fdb65596b387ab1e63 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 extern {
     static mut a: libc::c_int;
index be3f5ba7da86de9745b8f1690c5269e4a51b971e..fbcad79ac46e7502fddc2aacd4408ab56b0b8897 100644 (file)
@@ -10,7 +10,7 @@
 
 // error-pattern:unsupported cast
 
-use std::libc;
+extern crate libc;
 
 fn main() {
   println!("{:?}", 1.0 as *libc::FILE); // Can't cast float to foreign.
index 93f55261574ead6259bcf71de6d4af4e56e9ce41..c11d269a89755e41351e8fe3d24f0f64c11cb55e 100644 (file)
 // Testing that runtime failure doesn't cause callbacks to abort abnormally.
 // Instead the failure will be delivered after the callbacks return.
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     extern {
         pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
index 2430c5bb666b5de07b56df2ff2c73e9e5fc96244..671530425908ac3fd91a3ad71257ea2f88a1aef8 100644 (file)
 // See the hack in upcall_call_shim_on_c_stack where it messes
 // with the stack limit.
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     extern {
         pub fn rust_get_argc() -> libc::c_int;
index 7e05bcc1fd2266f03fe16c0f2c3fd5ed3ff89792..9ee1b85d85672503f0e5fb1bc7fe78d83c2970c4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 #[link(name = "rustrt")]
 extern {
index d590c35d9e2185600b860ff6f7b557ef64dd0b20..89cbbc24475880479465b2ba19b3fb10429c2ef6 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 9a02768faebe16758370daf62205ed0a8890c8bc..c02a24c3f0847c469023108accc9f2429f9ca121 100644 (file)
@@ -8,8 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-mod libc {
-    use std::libc::{c_char, c_long, c_longlong};
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
+
+mod mlibc {
+    use libc::{c_char, c_long, c_longlong};
 
     extern {
         pub fn atol(x: *c_char) -> c_long;
@@ -18,11 +22,11 @@ mod libc {
 }
 
 fn atol(s: ~str) -> int {
-    s.with_c_str(|x| unsafe { libc::atol(x) as int })
+    s.with_c_str(|x| unsafe { mlibc::atol(x) as int })
 }
 
 fn atoll(s: ~str) -> i64 {
-    s.with_c_str(|x| unsafe { libc::atoll(x) as i64 })
+    s.with_c_str(|x| unsafe { mlibc::atoll(x) as i64 })
 }
 
 pub fn main() {
index d511930c70fa7a3add33363b8f61e0fd4fd335df..7b17b578b82b793040201e8fc7acabd40ffcc5af 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 extern fn foo() {}
 
index 83232b408731d514c62d11c56af59e823ceb20f9..10c1d474f1ae05e458a04bb25b341f4be6763dcb 100644 (file)
@@ -17,6 +17,7 @@
 // instead of in std.
 
 #[feature(macro_rules)];
+extern crate libc;
 
 extern crate native;
 extern crate green;
@@ -34,7 +35,7 @@ mod $name {
             #[allow(unused_imports)];
 
             use std::io::timer;
-            use std::libc;
+            use libc;
             use std::str;
             use std::io::process::{Process, ProcessOutput};
             use native;
@@ -87,7 +88,7 @@ pub fn sleeper() -> Process {
 pub fn test_destroy_actually_kills(force: bool) {
     use std::io::process::{Process, ProcessOutput, ExitStatus, ExitSignal};
     use std::io::timer;
-    use std::libc;
+    use libc;
     use std::str;
 
     #[cfg(unix,not(target_os="android"))]
index 67f2d750cc024d98fc46c0293c4aab53327b3f03..84574fb6787d29fc53705ed81bc39db85b70f92b 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 701ae33132dc38b60f4f3d53636eee7216b07577..60b80356d9faa263e2b0228126e0d055e9bb55db 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 16142b2f8967cc5c4d9568ae68d0e6e8fef81d1e..391fdc616dc2e29014e3120d74b192f744789f8f 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index c67810bb17a8d05a35275d0c6f15faddc3a4847e..a1aa2adc4310aeecf0b5f6b555b583f57c68988b 100644 (file)
 // make sure the stack pointers are maintained properly in both
 // directions
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index ef1b26fc1af052c3531e097ad88d7121e0686244..26fc334026f4882cdd67f2c3a6c91d26a68c5aa9 100644 (file)
 // This creates a bunch of descheduling tasks that run concurrently
 // while holding onto C stacks
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index ba4f0ccfe648569b5808a93e05dd7952776c722e..aec7ee4341241e432a2953513a2d8d2f94a8ccf8 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 130f04b3fb2adee9246171c411d3537118d837db..147cfb16fa2fd3e3ab49ff43f2ebdde0a728503a 100644 (file)
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate libc;
+
 use std::cast;
-use std::libc;
 use std::unstable::run_in_bare_thread;
 
 #[link(name = "rustrt")]
index 8a6c0e4abcef4d59f3587f81ba812c8e154f8a6f..a36083e829319268e51d30cae2bc09a8b4ad55ba 100644 (file)
@@ -12,7 +12,7 @@
 // calling pin_task and that's having wierd side-effects.
 
 mod rustrt1 {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
@@ -21,7 +21,7 @@ mod rustrt1 {
 }
 
 mod rustrt2 {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 7e6a362cabebbed65326552c514bf640142c3ecf..e35aaaf7f76d8941c69f138af3749d8c15cf9879 100644 (file)
@@ -8,8 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-mod libc {
-    use std::libc::{c_char, size_t};
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
+
+mod mlibc {
+    extern crate libc;
+    use self::libc::{c_char, size_t};
 
     extern {
         #[link_name = "strlen"]
@@ -21,7 +26,7 @@ fn strlen(str: ~str) -> uint {
     // C string is terminated with a zero
     str.with_c_str(|buf| {
         unsafe {
-            libc::my_strlen(buf) as uint
+            mlibc::my_strlen(buf) as uint
         }
     })
 }
index 2f58765394131c916eef0980f2efc287c00286c3..e1ed0b8ea3b0c0743ba2a5663c553f581f2b6b9e 100644 (file)
@@ -8,8 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
+
 mod foo {
-    use std::libc::c_int;
+    use libc::c_int;
 
     extern {
         pub static errno: c_int;
index eef45532265a38c84130ed86109c8574ca1ccbb8..0bf97a7d9b48c69dd38d5e2c66cbf6d5bbd8d06c 100644 (file)
@@ -11,7 +11,7 @@
 // ABI is cdecl by default
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     #[link(name = "rustrt")]
     extern {
index 7c9d2dfa87cd1a4ae7ac21815bae48cafa425c99..3c7e878c3189041ac7b3103ddde7978fbc3befc3 100644 (file)
@@ -8,6 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
+
 mod bar {
     extern {}
 }
@@ -16,8 +20,8 @@ mod zed {
     extern {}
 }
 
-mod libc {
-    use std::libc::{c_int, c_void, size_t, ssize_t};
+mod mlibc {
+    use libc::{c_int, c_void, size_t, ssize_t};
 
     extern {
         pub fn write(fd: c_int, buf: *c_void, count: size_t) -> ssize_t;
index 70d2c58a631e3932025c0ec11916a97b3355fa11..3befa4e7fb43a3e6744483e413de912b87c5d39f 100644 (file)
@@ -11,7 +11,7 @@
 #[crate_id="rust_get_test_int"];
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     extern {
         pub fn rust_get_test_int() -> libc::intptr_t;
index f482790ef4c45098a74cad2aace970b317f09b8a..b6ff31269c7bdc42eea4b9652634bfc4cd60ca16 100644 (file)
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate libc;
+
 use std::cast;
-use std::libc::{c_double, c_int};
+use libc::{c_double, c_int};
 
 fn to_c_int(v: &mut int) -> &mut c_int {
     unsafe {
@@ -26,7 +28,7 @@ fn lgamma(n: c_double, value: &mut int) -> c_double {
 }
 
 mod m {
-    use std::libc::{c_double, c_int};
+    use libc::{c_double, c_int};
 
     #[link_name = "m"]
     extern {
index 0ffbdc3c5b8974b77dbfa0a08e18492e3140e993..a301aa6baa4c49a29466b4db259ea247f5979639 100644 (file)
@@ -14,9 +14,9 @@
 #[feature(managed_boxes)];
 
 extern crate socketlib;
+extern crate libc;
 
 use socketlib::socket;
-use std::libc;
 
 pub fn main() {
     let fd: libc::c_int = 1 as libc::c_int;
index 404d29fb93ee285fafe9375d36f1c582fd2dbf41..5823c473caa4cab842fd703f49668508a2401b5f 100644 (file)
@@ -13,7 +13,8 @@
 // Incorrect struct size computation in the FFI, because of not taking
 // the alignment of elements into account.
 
-use std::libc::{c_uint, uint32_t, c_void};
+extern crate libc;
+use libc::{c_uint, uint32_t, c_void};
 
 struct KEYGEN {
     hash_algorithm: [c_uint, ..2],
index b8205d9635b45894f2de9442495fe2d3221220ed..b23158522a308dc274ff7dbc634b094c46011ffa 100644 (file)
@@ -8,9 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
 
 use std::cast::transmute;
-use std::libc::c_void;
+use libc::c_void;
 
 struct NonCopyable(*c_void);
 
index 251ae2f319494faab16d9abe641a08d97fb32afe..1bda73a16c9eb5c2bd75d469badac657bcd3a6f1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 extern {
     #[link_name = "malloc"]
index 2235676441047eeccb28f5ae04824fab82d1ae3e..b9e174ee86b6794ad4eea2c3e450d475d4fc3249 100644 (file)
@@ -157,7 +157,7 @@ pub fn f() { }
 
 mod test_foreign_items {
     pub mod rustrt {
-        use std::libc;
+        extern crate libc;
 
         extern {
             #[attr];
index 5d89a2d5b3c8dc288733e58ecfd4e954ec80205c..2194453aac29aded856ee6917f20de869c1d6aeb 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 extern {
     fn rust_get_test_int() -> libc::intptr_t;
index 440acbcf4da6b3eb6bfcd27a5cc5a4d357a906e4..f1ba95b5efe90d26998327917f801e705906432e 100644 (file)
@@ -18,7 +18,7 @@
 use std::task;
 
 mod rustrt {
-    use std::libc;
+    extern crate libc;
 
     extern {
         pub fn debug_get_stk_seg() -> *u8;
index ca79c304802bd3c6b76fa6f060ff00cbd696d873..8631755f37fd9a7895ab5678957c2cda5f509eec 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc::c_int;
-use std::libc;
+// ignore-fast doesn't like extern crate
+
+extern crate libc;
+use libc::c_int;
 
 pub struct Fd(c_int);
 
index 5e45386353b2bf08ab4e722816d21d95eb3f84ca..aa4e91320f755b7191aef46ab1f8cfdd9f192677 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 #[cfg(target_os = "macos")]
 #[link(name = "CoreFoundation", kind = "framework")]
index 3b80d9ce491ccdac200278976aca945deebd1fbe..45445ed84f9ed6d61d926b98d644ba0ce6e00a31 100644 (file)
@@ -22,8 +22,8 @@
 
 extern crate green;
 extern crate rustuv;
+extern crate libc;
 
-use std::libc;
 use std::io::process;
 use std::io::signal::{Listener, Interrupt};
 
index c38df0f7a225ab22378bc374171d0cb82501c5d5..2c5245d5b38589bfa4b020aa12c11e2c60497595 100644 (file)
 
 extern crate arena;
 extern crate collections;
+extern crate libc;
 
 use arena::Arena;
 use collections::HashMap;
 use std::cast;
-use std::libc;
 use std::mem;
 
 type Type<'tcx> = &'tcx TypeStructure<'tcx>;
index 8cac6e8558f310b0e93f904a5aa69aa81c37f999..b0198d56e05a57b382299d1ab0204cb1a700221f 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate libc;
 use std::cast;
-use std::libc;
 use std::mem;
 
 struct arena(());
index ef43dad2c68ea3fcd641ab40a8f6ea0717a2c9e9..2f059c3531d1e0f845e5dbc56387d7a02260e4a2 100644 (file)
 
 // ignore-fast
 
+extern crate libc;
+
 use std::io::TempDir;
 use std::os;
-use std::libc;
 use std::io;
 use std::io::fs;
 
index 0afe01bf7edc8cea01d44ac0ac9a606c3266b8d2..4c88caa1d2c198d24d7ec8080537a377b22a3e4b 100644 (file)
@@ -12,7 +12,7 @@
 // statics cannot. This ensures that there's some form of error if this is
 // attempted.
 
-use std::libc;
+extern crate libc;
 
 #[link(name = "rustrt")]
 extern {
index e3f2456c4c44248ebdfbb133c7b4a52f43101c43..b87535713a76d54903d758c606fbd3143630a499 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::libc;
+extern crate libc;
 
 pub fn main() {
   let f = 1 as *libc::FILE;
index 61478e3fdb49ade8f49218c9b33a9a858510088c..73a24ee43e688004e61bd9c9a1eaed444438f40f 100644 (file)
@@ -16,8 +16,8 @@
 #[feature(phase)];
 #[phase(syntax, link)]
 extern crate log;
+extern crate libc;
 
-use std::libc;
 use std::io::net::ip::{Ipv4Addr, SocketAddr};
 use std::io::net::tcp::{TcpListener, TcpStream};
 use std::io::{Acceptor, Listener};
index 9cb2f22d38e940a0da368fac248e73dfeccabe97..903b76a29ceabb01d9faac6a04d2da64fa7e80b0 100644 (file)
@@ -8,8 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate libc;
 use std::c_str::CString;
-use std::libc::{c_char, c_int};
+use libc::{c_char, c_int};
+
+// ignore-fast doesn't like extern crate
 
 extern {
     fn sprintf(s: *mut c_char, format: *c_char, ...) -> c_int;