diff --git a/Cargo.lock b/Cargo.lock index 830ca58..3c2e157 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,6 +717,7 @@ dependencies = [ name = "xash3d-protocol" version = "0.2.0" dependencies = [ + "autocfg", "bitflags 2.5.0", "log", ] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 090e8b0..a593034 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -20,3 +20,6 @@ net = [] [dependencies] log = "0.4.18" bitflags = "2.4" + +[build-dependencies] +autocfg = "1" diff --git a/protocol/build.rs b/protocol/build.rs new file mode 100644 index 0000000..b52d41d --- /dev/null +++ b/protocol/build.rs @@ -0,0 +1,7 @@ +fn main() { + let ac = autocfg::new(); + println!("cargo:rustc-check-cfg=cfg(has_doc_auto_cfg)"); + if ac.probe_raw("#![feature(doc_auto_cfg)]").is_ok() { + println!("cargo:rustc-cfg=has_doc_auto_cfg"); + } +} diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 735e6d8..97395a2 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -7,6 +7,7 @@ //! Xash3D protocol between clients, servers and masters. #![cfg_attr(all(not(feature = "std"), not(test)), no_std)] +#![cfg_attr(all(doc, has_doc_auto_cfg), feature(doc_auto_cfg))] #[cfg(feature = "alloc")] extern crate alloc;