Skip to content

Commit adf24e7

Browse files
authored
Switch to the well-known feature name for docsrs. (#1126)
Switch from using a custom `doc_cfg` feature to using the existing `docsrs` feature.
1 parent ad83f40 commit adf24e7

File tree

15 files changed

+42
-44
lines changed

15 files changed

+42
-44
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ harness = false
9292

9393
[package.metadata.docs.rs]
9494
features = ["all-apis"]
95-
rustdoc-args = ["--cfg", "doc_cfg"]
9695
targets = [
9796
"x86_64-unknown-linux-gnu",
9897
"i686-unknown-linux-gnu",
@@ -262,7 +261,6 @@ check-cfg = [
262261
'cfg(core_ffi_c)',
263262
'cfg(core_intrinsics)',
264263
'cfg(criterion)',
265-
'cfg(doc_cfg)',
266264
'cfg(document_experimental_runtime_api)',
267265
'cfg(fix_y2038)',
268266
'cfg(freebsdlike)',

src/backend/libc/event/epoll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
261261
/// For each event of interest, an element is written to `events`. On
262262
/// success, this returns the number of written elements.
263263
#[cfg(feature = "alloc")]
264-
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
264+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
265265
pub fn wait(epoll: impl AsFd, event_list: &mut EventVec, timeout: c::c_int) -> io::Result<()> {
266266
// SAFETY: We're calling `epoll_wait` via FFI and we know how it
267267
// behaves.

src/backend/libc/fs/dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Dir {
220220
/// `fchdir(self)`
221221
#[cfg(feature = "process")]
222222
#[cfg(not(any(target_os = "fuchsia", target_os = "vita", target_os = "wasi")))]
223-
#[cfg_attr(doc_cfg, doc(cfg(feature = "process")))]
223+
#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
224224
#[inline]
225225
pub fn chdir(&self) -> io::Result<()> {
226226
fchdir(unsafe { BorrowedFd::borrow_raw(c::dirfd(self.libc_dir.as_ptr())) })

src/backend/linux_raw/event/epoll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
270270
///
271271
/// [Linux]: https://man7.org/linux/man-pages/man2/epoll_wait.2.html
272272
#[cfg(feature = "alloc")]
273-
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc"), alias = "epoll_wait"))]
273+
#[cfg_attr(docsrs, doc(cfg(feature = "alloc"), alias = "epoll_wait"))]
274274
#[inline]
275275
pub fn wait(epoll: impl AsFd, event_list: &mut EventVec, timeout: c::c_int) -> io::Result<()> {
276276
// SAFETY: We're calling `epoll_wait` via FFI and we know how it

src/backend/linux_raw/fs/dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl Dir {
234234

235235
/// `fchdir(self)`
236236
#[cfg(feature = "process")]
237-
#[cfg_attr(doc_cfg, doc(cfg(feature = "process")))]
237+
#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
238238
#[inline]
239239
pub fn chdir(&self) -> io::Result<()> {
240240
fchdir(&self.fd)

src/io/is_read_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use backend::fd::AsFd;
1313
///
1414
/// [`is_file_read_write`]: crate::fs::is_file_read_write
1515
#[inline]
16-
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "fs", feature = "net"))))]
16+
#[cfg_attr(docsrs, doc(cfg(all(feature = "fs", feature = "net"))))]
1717
pub fn is_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> {
1818
backend::io::syscalls::is_read_write(fd.as_fd())
1919
}

src/lib.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#![allow(stable_features)]
101101
#![cfg_attr(linux_raw, deny(unsafe_code))]
102102
#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
103-
#![cfg_attr(doc_cfg, feature(doc_cfg))]
103+
#![cfg_attr(docsrs, feature(doc_cfg))]
104104
#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
105105
#![cfg_attr(core_ffi_c, feature(core_ffi_c))]
106106
#![cfg_attr(core_c_str, feature(core_c_str))]
@@ -196,63 +196,63 @@ pub mod fd {
196196

197197
// The public API modules.
198198
#[cfg(feature = "event")]
199-
#[cfg_attr(doc_cfg, doc(cfg(feature = "event")))]
199+
#[cfg_attr(docsrs, doc(cfg(feature = "event")))]
200200
pub mod event;
201201
#[cfg(not(windows))]
202202
pub mod ffi;
203203
#[cfg(not(windows))]
204204
#[cfg(feature = "fs")]
205-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
205+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
206206
pub mod fs;
207207
pub mod io;
208208
#[cfg(linux_kernel)]
209209
#[cfg(feature = "io_uring")]
210-
#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
210+
#[cfg_attr(docsrs, doc(cfg(feature = "io_uring")))]
211211
pub mod io_uring;
212212
pub mod ioctl;
213213
#[cfg(not(any(windows, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
214214
#[cfg(feature = "mm")]
215-
#[cfg_attr(doc_cfg, doc(cfg(feature = "mm")))]
215+
#[cfg_attr(docsrs, doc(cfg(feature = "mm")))]
216216
pub mod mm;
217217
#[cfg(linux_kernel)]
218218
#[cfg(feature = "mount")]
219-
#[cfg_attr(doc_cfg, doc(cfg(feature = "mount")))]
219+
#[cfg_attr(docsrs, doc(cfg(feature = "mount")))]
220220
pub mod mount;
221221
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
222222
#[cfg(feature = "net")]
223-
#[cfg_attr(doc_cfg, doc(cfg(feature = "net")))]
223+
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
224224
pub mod net;
225225
#[cfg(not(any(windows, target_os = "espidf")))]
226226
#[cfg(feature = "param")]
227-
#[cfg_attr(doc_cfg, doc(cfg(feature = "param")))]
227+
#[cfg_attr(docsrs, doc(cfg(feature = "param")))]
228228
pub mod param;
229229
#[cfg(not(windows))]
230230
#[cfg(any(feature = "fs", feature = "mount", feature = "net"))]
231231
#[cfg_attr(
232-
doc_cfg,
232+
docsrs,
233233
doc(cfg(any(feature = "fs", feature = "mount", feature = "net")))
234234
)]
235235
pub mod path;
236236
#[cfg(feature = "pipe")]
237-
#[cfg_attr(doc_cfg, doc(cfg(feature = "pipe")))]
237+
#[cfg_attr(docsrs, doc(cfg(feature = "pipe")))]
238238
#[cfg(not(any(windows, target_os = "wasi")))]
239239
pub mod pipe;
240240
#[cfg(not(windows))]
241241
#[cfg(feature = "process")]
242-
#[cfg_attr(doc_cfg, doc(cfg(feature = "process")))]
242+
#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
243243
pub mod process;
244244
#[cfg(feature = "procfs")]
245245
#[cfg(linux_kernel)]
246-
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
246+
#[cfg_attr(docsrs, doc(cfg(feature = "procfs")))]
247247
pub mod procfs;
248248
#[cfg(not(windows))]
249249
#[cfg(not(target_os = "wasi"))]
250250
#[cfg(feature = "pty")]
251-
#[cfg_attr(doc_cfg, doc(cfg(feature = "pty")))]
251+
#[cfg_attr(docsrs, doc(cfg(feature = "pty")))]
252252
pub mod pty;
253253
#[cfg(not(windows))]
254254
#[cfg(feature = "rand")]
255-
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
255+
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
256256
pub mod rand;
257257
#[cfg(not(any(
258258
windows,
@@ -262,35 +262,35 @@ pub mod rand;
262262
target_os = "wasi"
263263
)))]
264264
#[cfg(feature = "shm")]
265-
#[cfg_attr(doc_cfg, doc(cfg(feature = "shm")))]
265+
#[cfg_attr(docsrs, doc(cfg(feature = "shm")))]
266266
pub mod shm;
267267
#[cfg(not(windows))]
268268
#[cfg(feature = "stdio")]
269-
#[cfg_attr(doc_cfg, doc(cfg(feature = "stdio")))]
269+
#[cfg_attr(docsrs, doc(cfg(feature = "stdio")))]
270270
pub mod stdio;
271271
#[cfg(feature = "system")]
272272
#[cfg(not(any(windows, target_os = "wasi")))]
273-
#[cfg_attr(doc_cfg, doc(cfg(feature = "system")))]
273+
#[cfg_attr(docsrs, doc(cfg(feature = "system")))]
274274
pub mod system;
275275
#[cfg(not(any(windows, target_os = "vita")))]
276276
#[cfg(feature = "termios")]
277-
#[cfg_attr(doc_cfg, doc(cfg(feature = "termios")))]
277+
#[cfg_attr(docsrs, doc(cfg(feature = "termios")))]
278278
pub mod termios;
279279
#[cfg(not(windows))]
280280
#[cfg(feature = "thread")]
281-
#[cfg_attr(doc_cfg, doc(cfg(feature = "thread")))]
281+
#[cfg_attr(docsrs, doc(cfg(feature = "thread")))]
282282
pub mod thread;
283283
#[cfg(not(any(windows, target_os = "espidf")))]
284284
#[cfg(feature = "time")]
285-
#[cfg_attr(doc_cfg, doc(cfg(feature = "time")))]
285+
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
286286
pub mod time;
287287

288288
// "runtime" is also a public API module, but it's only for libc-like users.
289289
#[cfg(not(windows))]
290290
#[cfg(feature = "runtime")]
291291
#[cfg(linux_raw)]
292292
#[cfg_attr(not(document_experimental_runtime_api), doc(hidden))]
293-
#[cfg_attr(doc_cfg, doc(cfg(feature = "runtime")))]
293+
#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))]
294294
pub mod runtime;
295295

296296
// Temporarily provide some mount functions for use in the fs module for
@@ -315,7 +315,7 @@ pub(crate) mod mount;
315315
target_arch = "x86",
316316
)
317317
))]
318-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
318+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
319319
pub(crate) mod fs;
320320

321321
// Similarly, declare `path` as a non-public module if needed.

src/path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod dec_int;
66

77
pub use arg::{option_into_with_c_str, Arg};
88
#[cfg(feature = "itoa")]
9-
#[cfg_attr(doc_cfg, doc(cfg(feature = "itoa")))]
9+
#[cfg_attr(docsrs, doc(cfg(feature = "itoa")))]
1010
pub use dec_int::DecInt;
1111

1212
pub(crate) const SMALL_PATH_BUFFER_SIZE: usize = 256;

src/process/chdir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use {
2121
/// [Linux]: https://man7.org/linux/man-pages/man2/chdir.2.html
2222
#[inline]
2323
#[cfg(feature = "fs")]
24-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
24+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
2525
pub fn chdir<P: path::Arg>(path: P) -> io::Result<()> {
2626
path.into_with_c_str(backend::process::syscalls::chdir)
2727
}
@@ -52,7 +52,7 @@ pub fn fchdir<Fd: AsFd>(fd: Fd) -> io::Result<()> {
5252
/// [Linux]: https://man7.org/linux/man-pages/man3/getcwd.3.html
5353
#[cfg(all(feature = "alloc", feature = "fs"))]
5454
#[cfg(not(target_os = "wasi"))]
55-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
55+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
5656
#[inline]
5757
pub fn getcwd<B: Into<Vec<u8>>>(reuse: B) -> io::Result<CString> {
5858
_getcwd(reuse.into())

src/process/chroot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[cfg(feature = "fs")]
2-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
2+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
33
use crate::{backend, io, path};
44

55
/// `chroot(path)`—Change the process root directory.
@@ -9,7 +9,7 @@ use crate::{backend, io, path};
99
///
1010
/// [Linux]: https://man7.org/linux/man-pages/man2/chroot.2.html
1111
#[cfg(feature = "fs")]
12-
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
12+
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
1313
#[inline]
1414
pub fn chroot<P: path::Arg>(path: P) -> io::Result<()> {
1515
path.into_with_c_str(backend::process::syscalls::chroot)

0 commit comments

Comments
 (0)