summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-11-02 14:26:04 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-11-02 15:10:37 -0800
commitf7efe341156f2b959fe671504e4e07e1c75b7e92 (patch)
tree06aef864d589bfab9361b352339c47743ae6c480
parent14bf9deda66b5836706af4220dd3f4adc58aa8e2 (diff)
downloadrust-libc-f7efe341156f2b959fe671504e4e07e1c75b7e92.tar.gz
Add support to build as part of the standard library
-rw-r--r--src/dox.rs8
-rw-r--r--src/lib.rs13
2 files changed, 17 insertions, 4 deletions
diff --git a/src/dox.rs b/src/dox.rs
index 10e39348f8..3a608c8cb9 100644
--- a/src/dox.rs
+++ b/src/dox.rs
@@ -2,10 +2,10 @@ pub use self::imp::*;
#[cfg(not(dox))]
mod imp {
- pub use std::option::Option;
- pub use std::clone::Clone;
- pub use std::marker::Copy;
- pub use std::mem;
+ pub use core::option::Option;
+ pub use core::clone::Clone;
+ pub use core::marker::Copy;
+ pub use core::mem;
}
#[cfg(dox)]
diff --git a/src/lib.rs b/src/lib.rs
index ff53835fd1..db6e46b205 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,6 +11,8 @@
//! Crate docs
#![allow(bad_style, raw_pointer_derive, overflowing_literals, improper_ctypes)]
+#![crate_type = "rlib"]
+#![crate_name = "libc"]
#![cfg_attr(dox, feature(no_core, lang_items))]
#![cfg_attr(dox, no_core)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
@@ -56,6 +58,17 @@
html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi"
))]
+// Attributes needed when building as part of the standard library
+#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api))]
+#![cfg_attr(stdbuild, no_std)]
+#![cfg_attr(stdbuild, staged_api)]
+#![cfg_attr(stdbuild, unstable(feature = "libc",
+ reason = "use `libc` from crates.io",
+ issue = "27783"))]
+
+#[cfg(all(not(stdbuild), not(dox)))]
+extern crate std as core;
+
#[macro_use] mod macros;
mod dox;