Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Use auto_doc_cfg instead of doc(cfg) attributes #2983

Merged
merged 19 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ rsa = ["libp2p-core/rsa"]
ecdsa = ["libp2p-core/ecdsa"]
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]

[package.metadata.docs.rs]
all-features = true

[dependencies]
bytes = "1"
futures = "0.3.1"
Expand Down Expand Up @@ -201,3 +198,10 @@ required-features = ["full"]
[[example]]
name = "distributed-key-value-store"
required-features = ["full"]

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
7 changes: 7 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,10 @@ serde = ["multihash/serde-codec", "dep:serde"]
[[bench]]
name = "peer_id"
harness = false

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
//! define how to upgrade each individual substream to use a protocol.
//! See the `upgrade` module.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[allow(clippy::derive_partial_eq_without_eq)]
mod keys_proto {
include!(concat!(env!("OUT_DIR"), "/keys_proto.rs"));
Expand Down
7 changes: 7 additions & 0 deletions misc/keygen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
libp2p-core = { version = "0.37.0", path = "../../core" }
base64 = "0.13.0"

umgefahren marked this conversation as resolved.
Show resolved Hide resolved
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
7 changes: 7 additions & 0 deletions misc/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ futures = "0.3.1"
libp2p = { path = "../..", features = ["full"] }
hyper = { version="0.14", features = ["server", "tcp", "http1"] }
tokio = { version = "1", features = ["rt-multi-thread"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions misc/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
//!
//! See `examples` directory for more.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(feature = "dcutr")]
mod dcutr;
#[cfg(feature = "gossipsub")]
Expand Down
7 changes: 7 additions & 0 deletions misc/multistream-select/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
rand = "0.8"
rw-stream-sink = { version = "0.3.0", path = "../../misc/rw-stream-sink" }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions misc/multistream-select/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
//! ```
//!

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod dialer_select;
mod length_delimited;
mod listener_select;
Expand Down
7 changes: 7 additions & 0 deletions misc/prost-codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }

[dev-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions misc/prost-codec/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use asynchronous_codec::{Decoder, Encoder};
use bytes::BytesMut;
use prost::Message;
Expand Down
7 changes: 7 additions & 0 deletions misc/quickcheck-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ license = "Unlicense/MIT"
[dependencies]
quickcheck = "1"
num-traits = "0.2"

umgefahren marked this conversation as resolved.
Show resolved Hide resolved
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions misc/quickcheck-ext/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub use quickcheck::*;

use core::ops::Range;
Expand Down
7 changes: 7 additions & 0 deletions misc/rw-stream-sink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ static_assertions = "1"

[dev-dependencies]
async-std = "1.0"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions misc/rw-stream-sink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
//! Each call to [`AsyncWrite::poll_write`] will send one packet to the sink.
//! Calls to [`AsyncRead::poll_read`] will read from the stream's incoming packets.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use futures::{prelude::*, ready};
use std::{
io::{self, Read},
Expand Down
7 changes: 7 additions & 0 deletions muxers/mplex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
[[bench]]
name = "split_send_size"
harness = false

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions muxers/mplex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod codec;
mod config;
mod io;
Expand Down
7 changes: 7 additions & 0 deletions muxers/yamux/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ parking_lot = "0.12"
thiserror = "1.0"
yamux = "0.10.0"
log = "0.4"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions muxers/yamux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
//! Implements the Yamux multiplexing protocol for libp2p, see also the
//! [specification](https://github.com/hashicorp/yamux/blob/master/spec.md).

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use futures::{
future,
prelude::*,
Expand Down
7 changes: 7 additions & 0 deletions protocols/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ async-std = { version = "1.10", features = ["attributes"] }
env_logger = "0.9"
clap = {version = "3.1.6", features = ["derive"]}
libp2p = { path = "../..", features = ["full"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
3 changes: 3 additions & 0 deletions protocols/autonat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
// DEALINGS IN THE SOFTWARE.

//! Implementation of the AutoNAT protocol.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod behaviour;
mod protocol;

Expand Down
7 changes: 7 additions & 0 deletions protocols/dcutr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] }
rand = "0.8"
clap = {version = "3.1.6", features = ["derive"]}

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/dcutr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
//! Implementation of the [libp2p Direct Connection Upgrade through Relay
//! specification](https://github.com/libp2p/specs/blob/master/relay/DCUtR.md).

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod behaviour;
mod handler;
mod protocol;
Expand Down
7 changes: 7 additions & 0 deletions protocols/floodsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ smallvec = "1.6.1"

[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/floodsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
//! Implements the floodsub protocol, see also the:
//! [spec](https://github.com/libp2p/specs/tree/master/pubsub).

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use libp2p_core::PeerId;

pub mod protocol;
Expand Down
7 changes: 7 additions & 0 deletions protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ derive_builder = "0.11.1"

[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/gossipsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
//! println!("Listening on {:?}", addr);
//! ```

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod error;
pub mod protocol;

Expand Down
7 changes: 7 additions & 0 deletions protocols/identify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ libp2p = { path = "../..", features = ["full"] }

[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/identify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
//! that negotiates and executes the protocol on every established connection, emitting
//! [`Event`]s.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub use self::behaviour::{Behaviour, Config, Event};
pub use self::protocol::{Info, UpgradeError, PROTOCOL_NAME, PUSH_PROTOCOL_NAME};

Expand Down
7 changes: 7 additions & 0 deletions protocols/kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ prost-build = "0.11"

[features]
serde = ["dep:serde", "bytes/serde"]

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions protocols/kad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
// TODO: we allow dead_code for now because this library contains a lot of unused code that will
// be useful later for record store
#![allow(dead_code)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod handler;
pub mod kbucket;
Expand Down
7 changes: 7 additions & 0 deletions protocols/mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ required-features = ["async-io"]
name = "use-tokio"
required-features = ["tokio"]


# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
3 changes: 3 additions & 0 deletions protocols/mdns/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
//! implements the `NetworkBehaviour` trait. This struct will automatically discover other
//! libp2p nodes on the local network.
//!

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use std::net::{Ipv4Addr, Ipv6Addr};
use std::time::Duration;

Expand Down
7 changes: 7 additions & 0 deletions protocols/ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ void = "1.0"
async-std = "1.6.2"
libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/ping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
//! [`Swarm`]: libp2p_swarm::Swarm
//! [`Transport`]: libp2p_core::Transport

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod handler;
mod protocol;

Expand Down
7 changes: 7 additions & 0 deletions protocols/relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
clap = {version = "3.1.6", features = ["derive"]}

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

//! libp2p circuit relay implementations

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod v2;

// Check that we can safely cast a `usize` to a `u64`.
Expand Down
7 changes: 7 additions & 0 deletions protocols/rendezvous/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ tokio = { version = "1.15", features = [ "rt-multi-thread", "time", "macros", "s

[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions protocols/rendezvous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub use self::codec::{Cookie, ErrorCode, Namespace, NamespaceTooLong, Registration, Ttl};

mod codec;
Expand Down
7 changes: 7 additions & 0 deletions protocols/request-response/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ async-std = "1.6.2"
env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] }
rand = "0.8"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]
Loading