Skip to content

Commit 7a83039

Browse files
committed
Merge pull request rust-lang#28 from alexcrichton/stdbuild
Add support to build as part of the standard library
2 parents d281d1a + f7efe34 commit 7a83039

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/dox.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ pub use self::imp::*;
22

33
#[cfg(not(dox))]
44
mod imp {
5-
pub use std::option::Option;
6-
pub use std::clone::Clone;
7-
pub use std::marker::Copy;
8-
pub use std::mem;
5+
pub use core::option::Option;
6+
pub use core::clone::Clone;
7+
pub use core::marker::Copy;
8+
pub use core::mem;
99
}
1010

1111
#[cfg(dox)]

src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! Crate docs
1212
1313
#![allow(bad_style, raw_pointer_derive, overflowing_literals, improper_ctypes)]
14+
#![crate_type = "rlib"]
15+
#![crate_name = "libc"]
1416
#![cfg_attr(dox, feature(no_core, lang_items))]
1517
#![cfg_attr(dox, no_core)]
1618
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
@@ -56,6 +58,17 @@
5658
html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi"
5759
))]
5860

61+
// Attributes needed when building as part of the standard library
62+
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api))]
63+
#![cfg_attr(stdbuild, no_std)]
64+
#![cfg_attr(stdbuild, staged_api)]
65+
#![cfg_attr(stdbuild, unstable(feature = "libc",
66+
reason = "use `libc` from crates.io",
67+
issue = "27783"))]
68+
69+
#[cfg(all(not(stdbuild), not(dox)))]
70+
extern crate std as core;
71+
5972
#[macro_use] mod macros;
6073
mod dox;
6174

0 commit comments

Comments
 (0)