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

enable doc_auto_cfg to show feature-req-hint in docs.rs #2271

Merged
merged 10 commits into from
Oct 9, 2024
5 changes: 5 additions & 0 deletions crates/burn-autodiff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-autodiff"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-autodiff"
documentation = "https://docs.rs/burn-autodiff"
version.workspace = true

[features]
Expand All @@ -29,3 +30,7 @@ log = { workspace = true }
burn-tensor = { path = "../burn-tensor", version = "0.15.0", default-features = false, features = [
"export_tests",
] }

[package.metadata.docs.rs]
features = ["default"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-autodiff/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! # Burn Autodiff
//!
Expand Down
3 changes: 2 additions & 1 deletion crates/burn-candle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-candle"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-candle"
documentation = "https://docs.rs/burn-candle"
version.workspace = true

[features]
Expand All @@ -18,7 +19,6 @@ cuda = ["candle-core/cuda"]
metal = ["candle-core/metal"]
accelerate = ["candle-core/accelerate"]


[dependencies]
derive-new = { workspace = true }
burn-tensor = { path = "../burn-tensor", version = "0.15.0", default-features = false }
Expand All @@ -37,3 +37,4 @@ burn-tensor = { path = "../burn-tensor", version = "0.15.0", default-features =

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-candle/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(unused)] // TODO remove when backend filled

//! Burn Candle Backend
Expand Down
3 changes: 2 additions & 1 deletion crates/burn-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-common"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-common"
documentation = "https://docs.rs/burn-common"
version.workspace = true

[features]
Expand All @@ -21,7 +22,6 @@ rayon = ["dep:rayon"]
getrandom = { workspace = true, features = ["js"] }
web-time = { version = "1.1.0" }


[dependencies]
data-encoding = { workspace = true }

Expand All @@ -39,3 +39,4 @@ dashmap = { workspace = true }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! # Burn Common Library
//!
Expand Down
2 changes: 2 additions & 0 deletions crates/burn-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-core"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-core"
documentation = "https://docs.rs/burn-core"
version.workspace = true

[features]
Expand Down Expand Up @@ -152,3 +153,4 @@ burn-autodiff = { path = "../burn-autodiff", version = "0.15.0" }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! The core crate of Burn.

Expand Down
2 changes: 2 additions & 0 deletions crates/burn-cuda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-cuda"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-cuda"
documentation = "https://docs.rs/burn-cuda"
version.workspace = true

[features]
Expand Down Expand Up @@ -36,3 +37,4 @@ burn-jit = { path = "../burn-jit", version = "0.15.0", default-features = false,

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions crates/burn-cuda/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate alloc;

use burn_jit::JitBackend;
Expand Down
8 changes: 2 additions & 6 deletions crates/burn-dataset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@ license.workspace = true
name = "burn-dataset"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-dataset"
documentation = "https://docs.rs/burn-dataset"
version.workspace = true

[features]
default = ["sqlite-bundled"]
doc = ["default"]

audio = ["hound"]

fake = ["dep:fake"]

sqlite = ["__sqlite-shared", "dep:rusqlite"]
sqlite-bundled = ["__sqlite-shared", "rusqlite/bundled"]

vision = ["dep:flate2", "dep:globwalk", "dep:burn-common", "dep:image"]

# internal
__sqlite-shared = [
"dep:r2d2",
Expand All @@ -31,7 +27,6 @@ __sqlite-shared = [
"dep:image",
"dep:gix-tempfile",
]

dataframe = ["dep:polars"]

[dependencies]
Expand Down Expand Up @@ -72,3 +67,4 @@ normal = ["strum", "strum_macros"]

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-dataset/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! # Burn Dataset
//!
Expand Down
2 changes: 2 additions & 0 deletions crates/burn-fusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-fusion"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-fusion"
documentation = "https://docs.rs/burn-fusion"
version.workspace = true

[features]
Expand All @@ -27,3 +28,4 @@ half = { workspace = true }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-fusion/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! # Burn Fusion
//!
Expand Down
5 changes: 5 additions & 0 deletions crates/burn-import/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license.workspace = true
name = "burn-import"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-import"
documentation = "https://docs.rs/burn-import"
version.workspace = true

default-run = "onnx2burn"
Expand Down Expand Up @@ -40,3 +41,7 @@ zip = { workspace = true, optional = true }
[dev-dependencies]
pretty_assertions = { workspace = true }
rstest = { workspace = true }

[package.metadata.docs.rs]
features = ["default"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-import/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(clippy::ptr_arg)]
#![allow(clippy::single_match)]
#![allow(clippy::upper_case_acronyms)]
Expand Down
2 changes: 2 additions & 0 deletions crates/burn-jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-jit"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-jit"
documentation = "https://docs.rs/burn-jit"
version.workspace = true

[features]
Expand Down Expand Up @@ -54,3 +55,4 @@ burn-ndarray = { path = "../burn-ndarray", version = "0.15.0", optional = true }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-jit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! Burn JIT Backend

Expand Down
2 changes: 2 additions & 0 deletions crates/burn-ndarray/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-ndarray"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-ndarray"
documentation = "https://docs.rs/burn-ndarray"
version.workspace = true

[features]
Expand Down Expand Up @@ -69,3 +70,4 @@ burn-tensor = { path = "../burn-tensor", version = "0.15.0", default-features =

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-ndarray/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! Burn ndarray backend.

Expand Down
2 changes: 2 additions & 0 deletions crates/burn-tch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-tch"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-tch"
documentation = "https://docs.rs/burn-tch"
version.workspace = true

[features]
Expand All @@ -33,3 +34,4 @@ burn-tensor = { path = "../burn-tensor", version = "0.15.0", default-features =

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-tch/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(clippy::single_range_in_vec_init)]

//! Burn Tch Backend
Expand Down
2 changes: 2 additions & 0 deletions crates/burn-tensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-tensor"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-tensor"
documentation = "https://docs.rs/burn-tensor"
version.workspace = true

[features]
Expand Down Expand Up @@ -53,3 +54,4 @@ rand = { workspace = true, features = ["std", "std_rng"] } # Default enables std

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-tensor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Allow deprecated `Data` and `DataSerialize`
#![allow(deprecated)]

Expand Down
7 changes: 6 additions & 1 deletion crates/burn-train/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-train"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-train"
documentation = "https://docs.rs/burn-train"
version.workspace = true

[features]
Expand All @@ -17,7 +18,10 @@ metrics = ["nvml-wrapper", "sysinfo", "systemstat"]
tui = ["ratatui", "crossterm"]

[dependencies]
burn-core = { path = "../burn-core", version = "0.15.0", features = ["dataset", "std"], default-features = false }
burn-core = { path = "../burn-core", version = "0.15.0", features = [
"dataset",
"std",
], default-features = false }

log = { workspace = true }
tracing-subscriber = { workspace = true }
Expand All @@ -42,3 +46,4 @@ burn-ndarray = { path = "../burn-ndarray", version = "0.15.0" }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions crates/burn-train/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! A library for training neural networks using the burn crate.

Expand Down
5 changes: 5 additions & 0 deletions crates/burn-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
name = "burn-wgpu"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-wgpu"
documentation = "https://docs.rs/burn-wgpu"
version.workspace = true

[features]
Expand All @@ -30,3 +31,7 @@ burn-fusion = { path = "../burn-fusion", version = "0.15.0", optional = true }
burn-jit = { path = "../burn-jit", version = "0.15.0", default-features = false, features = [
"export_tests",
] }

[package.metadata.docs.rs]
features = ["default"]
rustdoc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions crates/burn-wgpu/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate alloc;

#[cfg(feature = "template")]
Expand Down
17 changes: 16 additions & 1 deletion crates/burn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ license.workspace = true
name = "burn"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn"
documentation = "https://docs.rs/burn"
version.workspace = true
rust-version = "1.80"

[features]
default = ["burn-core/default", "burn-train?/default", "std"]
std = ["burn-core/std"]
doc = ["default", "burn-core/doc", "burn-train/doc"]
doc = [
"default",
"train",
"burn-core/doc",
"burn-train/doc",
"ndarray",
"autodiff",
"wgpu",
"cuda-jit",
"candle",
"tch",
"metrics",
"tui",
]

# Training with full features
train = ["burn-train", "autodiff", "dataset"]
Expand Down Expand Up @@ -72,3 +86,4 @@ burn-train = { path = "../burn-train", version = "0.15.0", optional = true, defa

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
Loading
Loading