From 2e4a088b789c2f4fd2fe622ff72bb2d638ec5851 Mon Sep 17 00:00:00 2001 From: oxalica Date: Mon, 6 Nov 2023 07:30:34 +0800 Subject: [PATCH] Uncollide tokio's `docsrs` feature tokio fails to compile with `--cfg docsrs` under latest nightly. --- Cargo.toml | 3 ++- src/lib.rs | 12 ++++++------ src/stdio.rs | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e59503c..43d3947 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,4 +93,5 @@ debug = 1 [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] +# Workaround: https://github.com/rust-lang/rust/issues/117622 +rustdoc-args = ["--cfg", "docsrs_"] diff --git a/src/lib.rs b/src/lib.rs index 0b2b085..e04f89c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,7 +51,7 @@ //! *Disabled by default.* //! - `tokio`: Enable compatible methods for [`tokio`](https://crates.io/crates/tokio) runtime. //! *Disabled by default.* -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs_, feature(doc_cfg))] #![warn(missing_docs)] use std::any::{type_name, Any, TypeId}; use std::collections::HashMap; @@ -109,25 +109,25 @@ pub mod router; pub mod server; #[cfg(feature = "forward")] -#[cfg_attr(docsrs, doc(cfg(feature = "forward")))] +#[cfg_attr(docsrs_, doc(cfg(feature = "forward")))] mod forward; #[cfg(feature = "client-monitor")] -#[cfg_attr(docsrs, doc(cfg(feature = "client-monitor")))] +#[cfg_attr(docsrs_, doc(cfg(feature = "client-monitor")))] pub mod client_monitor; #[cfg(all(feature = "stdio", unix))] -#[cfg_attr(docsrs, doc(cfg(all(feature = "stdio", unix))))] +#[cfg_attr(docsrs_, doc(cfg(all(feature = "stdio", unix))))] pub mod stdio; #[cfg(feature = "tracing")] -#[cfg_attr(docsrs, doc(cfg(feature = "tracing")))] +#[cfg_attr(docsrs_, doc(cfg(feature = "tracing")))] pub mod tracing; #[cfg(feature = "omni-trait")] mod omni_trait; #[cfg(feature = "omni-trait")] -#[cfg_attr(docsrs, doc(cfg(feature = "omni-trait")))] +#[cfg_attr(docsrs_, doc(cfg(feature = "omni-trait")))] pub use omni_trait::{LanguageClient, LanguageServer}; /// A convenient type alias for `Result` with `E` = [`enum@crate::Error`]. diff --git a/src/stdio.rs b/src/stdio.rs index 7c53c4c..4b2bc37 100644 --- a/src/stdio.rs +++ b/src/stdio.rs @@ -226,7 +226,7 @@ impl Write for PipeStdout { // Tokio compatibility. // We can simplify these if we have https://github.com/tokio-rs/tokio/issues/5785 #[cfg(feature = "tokio")] -#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))] +#[cfg_attr(docsrs_, doc(cfg(feature = "tokio")))] mod tokio_impl { use std::pin::Pin; use std::task::{Context, Poll};