Rename the dox configuration option to cross_platform_docs
The libc crate is used as a dependency of the Rust compiler. Its build system passes `--cfg dox` to all crates when generating their documentation. libc's documentation is generated when the build system is asked to generate the compiler documentation because `cargo doc` automatically documents all dependencies. When the dox configuration option is enabled, libc disables its dependency on the core crate and provides the necessary definitions itself. The dox configuration option is meant for generating documentation for a multitude of targets even if the core crate for that target is not installed. However, when documenting the compiler, it's not necessary to do that; we can just use core or std as usual. This change is motivated by the changes made to the compiler in rust-lang/rust#48171. With these changes, it's necessary to provide implementations of the Clone and Copy traits for some primitive types in the library that defines these traits (previously, these implementations were provided by the compiler). Normally, these traits (and thus the implementations) are provided by core, so any crate that uses `#![no_core]` must now provide its own copy of the implementations. Because libc doesn't provide its own copy of the implementations yet, and because the compiler's build system passes `--cfg dox` to libc, generating the documentation for the compiler fails when generating documentation for libc. By renaming the configuration option, libc will use core or std and will thus have the necessary definitions for the documentation to be generated successfully.
This commit is contained in:
parent
3e9ccfa72f
commit
18341fd23a
|
@ -16,7 +16,7 @@ cp ci/landing-page-head.html target/doc/index.html
|
|||
for target in $TARGETS; do
|
||||
echo documenting $target
|
||||
|
||||
rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
|
||||
rustdoc -o target/doc/$target --target $target src/lib.rs --cfg cross_platform_docs \
|
||||
--crate-name libc
|
||||
|
||||
echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pub use self::imp::*;
|
||||
|
||||
#[cfg(not(dox))]
|
||||
#[cfg(not(cross_platform_docs))]
|
||||
mod imp {
|
||||
pub use core::option::Option;
|
||||
pub use core::clone::Clone;
|
||||
|
@ -8,7 +8,7 @@ mod imp {
|
|||
pub use core::mem;
|
||||
}
|
||||
|
||||
#[cfg(dox)]
|
||||
#[cfg(cross_platform_docs)]
|
||||
mod imp {
|
||||
pub enum Option<T> {
|
||||
Some(T),
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#![allow(bad_style, overflowing_literals, improper_ctypes)]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_name = "libc"]
|
||||
#![cfg_attr(dox, feature(no_core, lang_items))]
|
||||
#![cfg_attr(dox, no_core)]
|
||||
#![cfg_attr(cross_platform_docs, feature(no_core, lang_items))]
|
||||
#![cfg_attr(cross_platform_docs, no_core)]
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico")]
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
#![cfg_attr(not(feature = "use_std"), no_std)]
|
||||
|
||||
#[cfg(all(not(dox), feature = "use_std"))]
|
||||
#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
|
||||
extern crate std as core;
|
||||
|
||||
#[macro_use] mod macros;
|
||||
|
|
|
@ -53,12 +53,12 @@ macro_rules! f {
|
|||
$($body:stmt);*
|
||||
})*) => ($(
|
||||
#[inline]
|
||||
#[cfg(not(dox))]
|
||||
#[cfg(not(cross_platform_docs))]
|
||||
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
|
||||
$($body);*
|
||||
}
|
||||
|
||||
#[cfg(dox)]
|
||||
#[cfg(cross_platform_docs)]
|
||||
#[allow(dead_code)]
|
||||
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
|
||||
loop {}
|
||||
|
|
|
@ -269,7 +269,7 @@ pub const INADDR_BROADCAST: in_addr_t = 4294967295;
|
|||
pub const INADDR_NONE: in_addr_t = 4294967295;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(dox)] {
|
||||
if #[cfg(cross_platform_docs)] {
|
||||
// on dox builds don't pull in anything
|
||||
} else if #[cfg(target_os = "l4re")] {
|
||||
// required libraries for L4Re are linked externally, ATM
|
||||
|
|
Loading…
Reference in New Issue