Skip to content

Commit 0031ce3

Browse files
Nemo157GuillaumeGomez
authored andcommitted
Suppress some cfg from being shown in the stdlib docs
1 parent 18fdd81 commit 0031ce3

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

library/alloc/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@
6565
#![doc(
6666
html_playground_url = "https://play.rust-lang.org/",
6767
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
68-
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
68+
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))),
69+
)]
70+
#![cfg_attr(not(bootstrap),
71+
doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr"))
6972
)]
7073
#![no_std]
7174
#![needs_allocator]
@@ -146,6 +149,8 @@
146149
#![feature(associated_type_bounds)]
147150
#![feature(slice_group_by)]
148151
#![feature(decl_macro)]
152+
#![feature(doc_cfg)]
153+
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
149154
// Allow testing this library
150155

151156
#[cfg(test)]

library/core/src/lib.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,30 @@
5858
html_playground_url = "https://play.rust-lang.org/",
5959
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6060
test(no_crate_inject, attr(deny(warnings))),
61-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
61+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
62+
)]
63+
#![cfg_attr(not(bootstrap),
64+
doc(cfg_hide(
65+
not(test),
66+
target_pointer_width = "16",
67+
target_pointer_width = "32",
68+
target_pointer_width = "64",
69+
target_has_atomic = "8",
70+
target_has_atomic = "16",
71+
target_has_atomic = "32",
72+
target_has_atomic = "64",
73+
target_has_atomic = "ptr",
74+
target_has_atomic_equal_alignment = "8",
75+
target_has_atomic_equal_alignment = "16",
76+
target_has_atomic_equal_alignment = "32",
77+
target_has_atomic_equal_alignment = "64",
78+
target_has_atomic_equal_alignment = "ptr",
79+
target_has_atomic_load_store = "8",
80+
target_has_atomic_load_store = "16",
81+
target_has_atomic_load_store = "32",
82+
target_has_atomic_load_store = "64",
83+
target_has_atomic_load_store = "ptr",
84+
))
6285
)]
6386
#![no_core]
6487
//
@@ -133,6 +156,7 @@
133156
#![feature(doc_notable_trait)]
134157
#![feature(doc_primitive)]
135158
#![feature(exhaustive_patterns)]
159+
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
136160
#![feature(extern_types)]
137161
#![feature(fundamental)]
138162
#![feature(if_let_guard)]

library/std/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@
193193
html_playground_url = "https://play.rust-lang.org/",
194194
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
195195
test(no_crate_inject, attr(deny(warnings))),
196-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
196+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
197+
)]
198+
#![cfg_attr(not(bootstrap),
199+
doc(cfg_hide(not(test), not(any(test, bootstrap))))
197200
)]
198201
// Don't link to std. We are std.
199202
#![no_std]
@@ -263,6 +266,7 @@
263266
#![feature(custom_test_frameworks)]
264267
#![feature(decl_macro)]
265268
#![feature(doc_cfg)]
269+
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
266270
#![feature(doc_keyword)]
267271
#![feature(doc_masked)]
268272
#![feature(doc_notable_trait)]

library/std/src/os/raw/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ macro_rules! type_alias {
4646
}
4747

4848
type_alias! { "char.md", c_char = u8, NonZero_c_char = NonZeroU8;
49+
#[doc(cfg(all()))]
4950
#[cfg(any(
5051
all(
5152
target_os = "linux",
@@ -88,6 +89,7 @@ type_alias! { "char.md", c_char = u8, NonZero_c_char = NonZeroU8;
8889
all(target_os = "fuchsia", target_arch = "aarch64")
8990
))]}
9091
type_alias! { "char.md", c_char = i8, NonZero_c_char = NonZeroI8;
92+
#[doc(cfg(all()))]
9193
#[cfg(not(any(
9294
all(
9395
target_os = "linux",
@@ -136,12 +138,16 @@ type_alias! { "ushort.md", c_ushort = u16, NonZero_c_ushort = NonZeroU16; }
136138
type_alias! { "int.md", c_int = i32, NonZero_c_int = NonZeroI32; }
137139
type_alias! { "uint.md", c_uint = u32, NonZero_c_uint = NonZeroU32; }
138140
type_alias! { "long.md", c_long = i32, NonZero_c_long = NonZeroI32;
141+
#[doc(cfg(all()))]
139142
#[cfg(any(target_pointer_width = "32", windows))] }
140143
type_alias! { "ulong.md", c_ulong = u32, NonZero_c_ulong = NonZeroU32;
144+
#[doc(cfg(all()))]
141145
#[cfg(any(target_pointer_width = "32", windows))] }
142146
type_alias! { "long.md", c_long = i64, NonZero_c_long = NonZeroI64;
147+
#[doc(cfg(all()))]
143148
#[cfg(all(target_pointer_width = "64", not(windows)))] }
144149
type_alias! { "ulong.md", c_ulong = u64, NonZero_c_ulong = NonZeroU64;
150+
#[doc(cfg(all()))]
145151
#[cfg(all(target_pointer_width = "64", not(windows)))] }
146152
type_alias! { "longlong.md", c_longlong = i64, NonZero_c_longlong = NonZeroI64; }
147153
type_alias! { "ulonglong.md", c_ulonglong = u64, NonZero_c_ulonglong = NonZeroU64; }

library/std/src/os/windows/raw.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ use crate::os::raw::c_void;
77
#[stable(feature = "raw_ext", since = "1.1.0")]
88
pub type HANDLE = *mut c_void;
99
#[cfg(target_pointer_width = "32")]
10+
#[doc(cfg(all()))]
1011
#[stable(feature = "raw_ext", since = "1.1.0")]
1112
pub type SOCKET = u32;
1213
#[cfg(target_pointer_width = "64")]
14+
#[doc(cfg(all()))]
1315
#[stable(feature = "raw_ext", since = "1.1.0")]
1416
pub type SOCKET = u64;

0 commit comments

Comments
 (0)