Skip to content

Commit 8c664ff

Browse files
authored
Unrolled build for #159014
Rollup merge of #159014 - GuillaumeGomez:doc-cfg-filter-doctest, r=Urgau [rustdoc] Do not take `doc(cfg())` into account when filtering doctests Part of #147033. Because it was using the `extract_cfg_from_attrs` common function, it was taking into account the `doc(cfg())` attributes the same as if they were a `cfg`. I didn't mark this PR as "fix" because I didn't handle the case of the doctest not being marked as ignored because I'm not sure if we should revisit the fact that we ignore these doctests or if we should just mark them as ignored (because of `target_feature(enable = "...")`). Setting @fmease as reviewer as they are likely the only one with context about this issue. 😆 r? @fmease
2 parents 7608eb7 + 49dae43 commit 8c664ff

44 files changed

Lines changed: 816 additions & 358 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

library/core/src/os/darwin/objc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub type SEL = *mut objc_selector;
6767
///
6868
/// # Example
6969
///
70-
/// ```no_run
70+
#[cfg_attr(target_os = "macos", doc = "```no_run")]
71+
#[cfg_attr(not(target_os = "macos"), doc = "```ignore (needs macos)")]
7172
/// #![feature(darwin_objc)]
7273
/// use core::os::darwin::objc;
7374
///
@@ -93,7 +94,8 @@ pub macro class($classname:expr) {{
9394
///
9495
/// # Examples
9596
///
96-
/// ```no_run
97+
#[cfg_attr(target_os = "macos", doc = "```no_run")]
98+
#[cfg_attr(not(target_os = "macos"), doc = "```ignore (needs macos)")]
9799
/// #![feature(darwin_objc)]
98100
/// use core::os::darwin::objc;
99101
///

library/std/src/os/aix/fs.rs

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ pub trait MetadataExt {
1616
///
1717
/// # Examples
1818
///
19-
/// ```no_run
19+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
20+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
2021
/// use std::fs;
2122
/// use std::io;
2223
/// use std::os::aix::fs::MetadataExt;
@@ -33,7 +34,8 @@ pub trait MetadataExt {
3334
///
3435
/// # Examples
3536
///
36-
/// ```no_run
37+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
38+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
3739
/// use std::fs;
3840
/// use std::io;
3941
/// use std::os::aix::fs::MetadataExt;
@@ -50,7 +52,8 @@ pub trait MetadataExt {
5052
///
5153
/// # Examples
5254
///
53-
/// ```no_run
55+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
56+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
5457
/// use std::fs;
5558
/// use std::io;
5659
/// use std::os::aix::fs::MetadataExt;
@@ -67,7 +70,8 @@ pub trait MetadataExt {
6770
///
6871
/// # Examples
6972
///
70-
/// ```no_run
73+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
74+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
7175
/// use std::fs;
7276
/// use std::io;
7377
/// use std::os::aix::fs::MetadataExt;
@@ -84,7 +88,8 @@ pub trait MetadataExt {
8488
///
8589
/// # Examples
8690
///
87-
/// ```no_run
91+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
92+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
8893
/// use std::fs;
8994
/// use std::io;
9095
/// use std::os::aix::fs::MetadataExt;
@@ -101,7 +106,8 @@ pub trait MetadataExt {
101106
///
102107
/// # Examples
103108
///
104-
/// ```no_run
109+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
110+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
105111
/// use std::fs;
106112
/// use std::io;
107113
/// use std::os::aix::fs::MetadataExt;
@@ -118,7 +124,8 @@ pub trait MetadataExt {
118124
///
119125
/// # Examples
120126
///
121-
/// ```no_run
127+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
128+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
122129
/// use std::fs;
123130
/// use std::io;
124131
/// use std::os::aix::fs::MetadataExt;
@@ -138,7 +145,8 @@ pub trait MetadataExt {
138145
///
139146
/// # Examples
140147
///
141-
/// ```no_run
148+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
149+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
142150
/// use std::fs;
143151
/// use std::io;
144152
/// use std::os::aix::fs::MetadataExt;
@@ -155,7 +163,8 @@ pub trait MetadataExt {
155163
///
156164
/// # Examples
157165
///
158-
/// ```no_run
166+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
167+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
159168
/// use std::fs;
160169
/// use std::io;
161170
/// use std::os::aix::fs::MetadataExt;
@@ -174,7 +183,8 @@ pub trait MetadataExt {
174183
///
175184
/// # Examples
176185
///
177-
/// ```no_run
186+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
187+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
178188
/// use std::fs;
179189
/// use std::io;
180190
/// use std::os::aix::fs::MetadataExt;
@@ -191,7 +201,8 @@ pub trait MetadataExt {
191201
///
192202
/// # Examples
193203
///
194-
/// ```no_run
204+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
205+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
195206
/// use std::fs;
196207
/// use std::io;
197208
/// use std::os::aix::fs::MetadataExt;
@@ -210,7 +221,8 @@ pub trait MetadataExt {
210221
///
211222
/// # Examples
212223
///
213-
/// ```no_run
224+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
225+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
214226
/// use std::fs;
215227
/// use std::io;
216228
/// use std::os::aix::fs::MetadataExt;
@@ -227,7 +239,8 @@ pub trait MetadataExt {
227239
///
228240
/// # Examples
229241
///
230-
/// ```no_run
242+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
243+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
231244
/// use std::fs;
232245
/// use std::io;
233246
/// use std::os::aix::fs::MetadataExt;
@@ -246,7 +259,8 @@ pub trait MetadataExt {
246259
///
247260
/// # Examples
248261
///
249-
/// ```no_run
262+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
263+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
250264
/// use std::fs;
251265
/// use std::io;
252266
/// use std::os::aix::fs::MetadataExt;
@@ -263,7 +277,8 @@ pub trait MetadataExt {
263277
///
264278
/// # Examples
265279
///
266-
/// ```no_run
280+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
281+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
267282
/// use std::fs;
268283
/// use std::io;
269284
/// use std::os::aix::fs::MetadataExt;
@@ -280,7 +295,8 @@ pub trait MetadataExt {
280295
///
281296
/// # Examples
282297
///
283-
/// ```no_run
298+
#[cfg_attr(target_os = "aix", doc = "```no_run")]
299+
#[cfg_attr(not(target_os = "aix"), doc = "```ignore (needs aix)")]
284300
/// use std::fs;
285301
/// use std::io;
286302
/// use std::os::aix::fs::MetadataExt;

library/std/src/os/fortanix_sgx/ffi.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
//!
33
//! # Examples
44
//!
5-
//! ```
5+
#![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"), doc = "```")]
6+
#![cfg_attr(
7+
not(all(target_vendor = "fortanix", target_env = "sgx")),
8+
doc = "```ignore (needs aix)"
9+
)]
610
//! use std::ffi::OsString;
711
//! use std::os::fortanix_sgx::ffi::OsStringExt;
812
//!
@@ -17,7 +21,11 @@
1721
//! assert_eq!(bytes, b"foo");
1822
//! ```
1923
//!
20-
//! ```
24+
#![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"), doc = "```")]
25+
#![cfg_attr(
26+
not(all(target_vendor = "fortanix", target_env = "sgx")),
27+
doc = "```ignore (needs aix)"
28+
)]
2129
//! use std::ffi::OsStr;
2230
//! use std::os::fortanix_sgx::ffi::OsStrExt;
2331
//!

library/std/src/os/freebsd/net.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub impl(self) trait UnixSocketExt {
2727
///
2828
/// # Examples
2929
///
30-
/// ```no_run
30+
#[cfg_attr(target_os = "freebsd", doc = "```no_run")]
31+
#[cfg_attr(not(target_os = "freebsd"), doc = "```ignore (needs freebsd)")]
3132
/// #![feature(unix_socket_ancillary_data)]
3233
/// use std::os::freebsd::net::UnixSocketExt;
3334
/// use std::os::unix::net::UnixDatagram;

library/std/src/os/hermit/ffi.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//!
33
//! # Examples
44
//!
5-
//! ```
5+
#![cfg_attr(target_os = "hermit", doc = "```")]
6+
#![cfg_attr(not(target_os = "hermit"), doc = "```ignore (needs hermit)")]
67
//! use std::ffi::OsString;
78
//! use std::os::hermit::ffi::OsStringExt;
89
//!
@@ -17,7 +18,8 @@
1718
//! assert_eq!(bytes, b"foo");
1819
//! ```
1920
//!
20-
//! ```
21+
#![cfg_attr(target_os = "hermit", doc = "```")]
22+
#![cfg_attr(not(target_os = "hermit"), doc = "```ignore (needs hermit)")]
2123
//! use std::ffi::OsStr;
2224
//! use std::os::hermit::ffi::OsStrExt;
2325
//!

library/std/src/os/hurd/fs.rs

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ pub trait MetadataExt {
1616
///
1717
/// # Examples
1818
///
19-
/// ```no_run
19+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
20+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
2021
/// use std::fs;
2122
/// use std::io;
2223
/// use std::os::hurd::fs::MetadataExt;
@@ -33,7 +34,8 @@ pub trait MetadataExt {
3334
///
3435
/// # Examples
3536
///
36-
/// ```no_run
37+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
38+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
3739
/// use std::fs;
3840
/// use std::io;
3941
/// use std::os::hurd::fs::MetadataExt;
@@ -50,7 +52,8 @@ pub trait MetadataExt {
5052
///
5153
/// # Examples
5254
///
53-
/// ```no_run
55+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
56+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
5457
/// use std::fs;
5558
/// use std::io;
5659
/// use std::os::hurd::fs::MetadataExt;
@@ -67,7 +70,8 @@ pub trait MetadataExt {
6770
///
6871
/// # Examples
6972
///
70-
/// ```no_run
73+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
74+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
7175
/// use std::fs;
7276
/// use std::io;
7377
/// use std::os::hurd::fs::MetadataExt;
@@ -84,7 +88,8 @@ pub trait MetadataExt {
8488
///
8589
/// # Examples
8690
///
87-
/// ```no_run
91+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
92+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
8893
/// use std::fs;
8994
/// use std::io;
9095
/// use std::os::hurd::fs::MetadataExt;
@@ -101,7 +106,8 @@ pub trait MetadataExt {
101106
///
102107
/// # Examples
103108
///
104-
/// ```no_run
109+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
110+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
105111
/// use std::fs;
106112
/// use std::io;
107113
/// use std::os::hurd::fs::MetadataExt;
@@ -118,7 +124,8 @@ pub trait MetadataExt {
118124
///
119125
/// # Examples
120126
///
121-
/// ```no_run
127+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
128+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
122129
/// use std::fs;
123130
/// use std::io;
124131
/// use std::os::hurd::fs::MetadataExt;
@@ -138,7 +145,8 @@ pub trait MetadataExt {
138145
///
139146
/// # Examples
140147
///
141-
/// ```no_run
148+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
149+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
142150
/// use std::fs;
143151
/// use std::io;
144152
/// use std::os::hurd::fs::MetadataExt;
@@ -155,7 +163,8 @@ pub trait MetadataExt {
155163
///
156164
/// # Examples
157165
///
158-
/// ```no_run
166+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
167+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
159168
/// use std::fs;
160169
/// use std::io;
161170
/// use std::os::hurd::fs::MetadataExt;
@@ -174,7 +183,8 @@ pub trait MetadataExt {
174183
///
175184
/// # Examples
176185
///
177-
/// ```no_run
186+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
187+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
178188
/// use std::fs;
179189
/// use std::io;
180190
/// use std::os::hurd::fs::MetadataExt;
@@ -191,7 +201,8 @@ pub trait MetadataExt {
191201
///
192202
/// # Examples
193203
///
194-
/// ```no_run
204+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
205+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
195206
/// use std::fs;
196207
/// use std::io;
197208
/// use std::os::hurd::fs::MetadataExt;
@@ -210,7 +221,8 @@ pub trait MetadataExt {
210221
///
211222
/// # Examples
212223
///
213-
/// ```no_run
224+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
225+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
214226
/// use std::fs;
215227
/// use std::io;
216228
/// use std::os::hurd::fs::MetadataExt;
@@ -227,7 +239,8 @@ pub trait MetadataExt {
227239
///
228240
/// # Examples
229241
///
230-
/// ```no_run
242+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
243+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
231244
/// use std::fs;
232245
/// use std::io;
233246
/// use std::os::hurd::fs::MetadataExt;
@@ -246,7 +259,8 @@ pub trait MetadataExt {
246259
///
247260
/// # Examples
248261
///
249-
/// ```no_run
262+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
263+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
250264
/// use std::fs;
251265
/// use std::io;
252266
/// use std::os::hurd::fs::MetadataExt;
@@ -263,7 +277,8 @@ pub trait MetadataExt {
263277
///
264278
/// # Examples
265279
///
266-
/// ```no_run
280+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
281+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
267282
/// use std::fs;
268283
/// use std::io;
269284
/// use std::os::hurd::fs::MetadataExt;
@@ -280,7 +295,8 @@ pub trait MetadataExt {
280295
///
281296
/// # Examples
282297
///
283-
/// ```no_run
298+
#[cfg_attr(target_os = "hurd", doc = "```no_run")]
299+
#[cfg_attr(not(target_os = "hurd"), doc = "```ignore (needs hurd)")]
284300
/// use std::fs;
285301
/// use std::io;
286302
/// use std::os::hurd::fs::MetadataExt;

0 commit comments

Comments
 (0)