Skip to content

Commit e0c438f

Browse files
Nemo157jyn514
authored andcommitted
Suppress some cfg from being shown in the stdlib docs
1 parent 74d0d3f commit e0c438f

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
@@ -62,7 +62,10 @@
6262
html_root_url = "https://doc.rust-lang.org/nightly/",
6363
html_playground_url = "https://play.rust-lang.org/",
6464
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
65-
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
65+
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))),
66+
)]
67+
#![cfg_attr(not(bootstrap),
68+
doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr"))
6669
)]
6770
#![no_std]
6871
#![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
@@ -55,7 +55,30 @@
5555
html_playground_url = "https://play.rust-lang.org/",
5656
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
5757
test(no_crate_inject, attr(deny(warnings))),
58-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
58+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
59+
)]
60+
#![cfg_attr(not(bootstrap),
61+
doc(cfg_hide(
62+
not(test),
63+
target_pointer_width = "16",
64+
target_pointer_width = "32",
65+
target_pointer_width = "64",
66+
target_has_atomic = "8",
67+
target_has_atomic = "16",
68+
target_has_atomic = "32",
69+
target_has_atomic = "64",
70+
target_has_atomic = "ptr",
71+
target_has_atomic_equal_alignment = "8",
72+
target_has_atomic_equal_alignment = "16",
73+
target_has_atomic_equal_alignment = "32",
74+
target_has_atomic_equal_alignment = "64",
75+
target_has_atomic_equal_alignment = "ptr",
76+
target_has_atomic_load_store = "8",
77+
target_has_atomic_load_store = "16",
78+
target_has_atomic_load_store = "32",
79+
target_has_atomic_load_store = "64",
80+
target_has_atomic_load_store = "ptr",
81+
))
5982
)]
6083
#![no_core]
6184
#![warn(deprecated_in_future)]
@@ -109,6 +132,7 @@
109132
#![feature(custom_inner_attributes)]
110133
#![feature(decl_macro)]
111134
#![feature(doc_cfg)]
135+
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
112136
#![cfg_attr(bootstrap, feature(doc_spotlight))]
113137
#![cfg_attr(not(bootstrap), feature(doc_notable_trait))]
114138
#![feature(duration_consts_2)]

library/std/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@
194194
html_playground_url = "https://play.rust-lang.org/",
195195
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
196196
test(no_crate_inject, attr(deny(warnings))),
197-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
197+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
198+
)]
199+
#![cfg_attr(not(bootstrap),
200+
doc(cfg_hide(not(test), not(any(test, bootstrap))))
198201
)]
199202
// Don't link to std. We are std.
200203
#![no_std]
@@ -259,6 +262,7 @@
259262
#![feature(custom_test_frameworks)]
260263
#![feature(decl_macro)]
261264
#![feature(doc_cfg)]
265+
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
262266
#![feature(doc_keyword)]
263267
#![feature(doc_masked)]
264268
#![cfg_attr(bootstrap, feature(doc_spotlight))]

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/sys/windows/ext/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)