From 75e6cdbfd030c7fe77bafaabbc574ff330e256b7 Mon Sep 17 00:00:00 2001 From: joriskleiber Date: Thu, 13 Jul 2023 21:45:42 +0200 Subject: [PATCH 1/3] process: fix raw_arg not showing up in docs --- tokio/src/macros/cfg.rs | 12 ++++++++++++ tokio/src/process/mod.rs | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 52ffc102bf3..692d246e69b 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -25,6 +25,18 @@ macro_rules! cfg_windows { } } +/// Enables unstable Windows-specific code. +/// Use this macro instead of `cfg(windows)` to generate docs properly. +macro_rules! cfg_windows_unstable { + ($($item:item)*) => { + $( + #[cfg(any(all(doc, docsrs), all(windows, tokio_unstable)))] + #[cfg_attr(docsrs, doc(cfg(all(windows, tokio_unstable))))] + $item + )* + } +} + /// Enables enter::block_on. macro_rules! cfg_block_on { ($($item:item)*) => { diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index d68a68995ec..35cc7ab00f4 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -400,20 +400,20 @@ impl Command { self } - /// Append literal text to the command line without any quoting or escaping. - /// - /// This is useful for passing arguments to `cmd.exe /c`, which doesn't follow - /// `CommandLineToArgvW` escaping rules. - /// - /// **Note**: This is an [unstable API][unstable] but will be stabilised once - /// tokio's MSRV is sufficiently new. See [the documentation on - /// unstable features][unstable] for details about using unstable features. - #[cfg(windows)] - #[cfg(tokio_unstable)] - #[cfg_attr(docsrs, doc(cfg(all(windows, tokio_unstable))))] - pub fn raw_arg>(&mut self, text_to_append_as_is: S) -> &mut Command { - self.std.raw_arg(text_to_append_as_is); - self + cfg_windows_unstable! { + /// [unstable]: crate#unstable-features + /// Append literal text to the command line without any quoting or escaping. + /// + /// This is useful for passing arguments to `cmd.exe /c`, which doesn't follow + /// `CommandLineToArgvW` escaping rules. + /// + /// **Note**: This is an [unstable API][unstable] but will be stabilised once + /// tokio's MSRV is sufficiently new. See [the documentation on + /// unstable features][unstable] for details about using unstable features. + pub fn raw_arg>(&mut self, text_to_append_as_is: S) -> &mut Command { + self.std.raw_arg(text_to_append_as_is); + self + } } /// Inserts or updates an environment variable mapping. From e1ea8d751520cccc9c43e2fe9f16c190f4060456 Mon Sep 17 00:00:00 2001 From: joriskleiber Date: Fri, 14 Jul 2023 11:44:00 +0200 Subject: [PATCH 2/3] process: brings the new unstable windows macro in line with other macros --- tokio/src/macros/cfg.rs | 4 ++-- tokio/src/process/mod.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 692d246e69b..a80e323cf43 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -27,10 +27,10 @@ macro_rules! cfg_windows { /// Enables unstable Windows-specific code. /// Use this macro instead of `cfg(windows)` to generate docs properly. -macro_rules! cfg_windows_unstable { +macro_rules! cfg_unstable_windows { ($($item:item)*) => { $( - #[cfg(any(all(doc, docsrs), all(windows, tokio_unstable)))] + #[cfg(all(any(all(doc, docsrs), windows), tokio_unstable))] #[cfg_attr(docsrs, doc(cfg(all(windows, tokio_unstable))))] $item )* diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 35cc7ab00f4..caeca456d43 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -400,7 +400,7 @@ impl Command { self } - cfg_windows_unstable! { + cfg_unstable_windows! { /// [unstable]: crate#unstable-features /// Append literal text to the command line without any quoting or escaping. /// From f58d41e538f67fed5ff214f94b64fae73f9b57d7 Mon Sep 17 00:00:00 2001 From: joriskleiber Date: Fri, 14 Jul 2023 14:42:18 +0200 Subject: [PATCH 3/3] process: fix move link to bottom --- tokio/src/process/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index caeca456d43..41353c04adf 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -401,7 +401,6 @@ impl Command { } cfg_unstable_windows! { - /// [unstable]: crate#unstable-features /// Append literal text to the command line without any quoting or escaping. /// /// This is useful for passing arguments to `cmd.exe /c`, which doesn't follow @@ -410,6 +409,8 @@ impl Command { /// **Note**: This is an [unstable API][unstable] but will be stabilised once /// tokio's MSRV is sufficiently new. See [the documentation on /// unstable features][unstable] for details about using unstable features. + /// + /// [unstable]: crate#unstable-features pub fn raw_arg>(&mut self, text_to_append_as_is: S) -> &mut Command { self.std.raw_arg(text_to_append_as_is); self