Skip to content

Commit 6166e9b

Browse files
authored
process: fix raw_arg not showing up in docs (#5865)
1 parent e52d56e commit 6166e9b

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

tokio/src/macros/cfg.rs

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ macro_rules! cfg_windows {
2525
}
2626
}
2727

28+
/// Enables unstable Windows-specific code.
29+
/// Use this macro instead of `cfg(windows)` to generate docs properly.
30+
macro_rules! cfg_unstable_windows {
31+
($($item:item)*) => {
32+
$(
33+
#[cfg(all(any(all(doc, docsrs), windows), tokio_unstable))]
34+
#[cfg_attr(docsrs, doc(cfg(all(windows, tokio_unstable))))]
35+
$item
36+
)*
37+
}
38+
}
39+
2840
/// Enables enter::block_on.
2941
macro_rules! cfg_block_on {
3042
($($item:item)*) => {

tokio/src/process/mod.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -400,20 +400,21 @@ impl Command {
400400
self
401401
}
402402

403-
/// Append literal text to the command line without any quoting or escaping.
404-
///
405-
/// This is useful for passing arguments to `cmd.exe /c`, which doesn't follow
406-
/// `CommandLineToArgvW` escaping rules.
407-
///
408-
/// **Note**: This is an [unstable API][unstable] but will be stabilised once
409-
/// tokio's MSRV is sufficiently new. See [the documentation on
410-
/// unstable features][unstable] for details about using unstable features.
411-
#[cfg(windows)]
412-
#[cfg(tokio_unstable)]
413-
#[cfg_attr(docsrs, doc(cfg(all(windows, tokio_unstable))))]
414-
pub fn raw_arg<S: AsRef<OsStr>>(&mut self, text_to_append_as_is: S) -> &mut Command {
415-
self.std.raw_arg(text_to_append_as_is);
416-
self
403+
cfg_unstable_windows! {
404+
/// Append literal text to the command line without any quoting or escaping.
405+
///
406+
/// This is useful for passing arguments to `cmd.exe /c`, which doesn't follow
407+
/// `CommandLineToArgvW` escaping rules.
408+
///
409+
/// **Note**: This is an [unstable API][unstable] but will be stabilised once
410+
/// tokio's MSRV is sufficiently new. See [the documentation on
411+
/// unstable features][unstable] for details about using unstable features.
412+
///
413+
/// [unstable]: crate#unstable-features
414+
pub fn raw_arg<S: AsRef<OsStr>>(&mut self, text_to_append_as_is: S) -> &mut Command {
415+
self.std.raw_arg(text_to_append_as_is);
416+
self
417+
}
417418
}
418419

419420
/// Inserts or updates an environment variable mapping.

0 commit comments

Comments
 (0)