From 5828a4fa8ca9f4e79d594e5c44a39ad51bf894c8 Mon Sep 17 00:00:00 2001 From: Yoav Lavi Date: Wed, 27 Apr 2022 19:10:53 +0200 Subject: [PATCH 1/2] Add caveat for covering features This section explains the caveats and possible solutions for features, detailing the tooling needed to 100% cover such a project. The need for this PR is based on a conversation with @Eh2406. Moved this PR here based on @Eh2406's comment: https://github.com/rust-lang/reference/pull/1195#issuecomment-1108968173 --- src/doc/src/reference/features.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc/src/reference/features.md b/src/doc/src/reference/features.md index 612f341a5d3..057a3bef311 100644 --- a/src/doc/src/reference/features.md +++ b/src/doc/src/reference/features.md @@ -513,3 +513,9 @@ source and inspect it. [`cargo vendor`]: ../commands/cargo-vendor.md [cargo-clone-crate]: https://crates.io/crates/cargo-clone-crate + +### Caveats + +Features, which are a form of conditional compilation, require an exponential number of configurations and test cases to be 100% covered. By default, testing, linting, Miri, docs and others will only run on the default set of features. + +There are certain tools like [cargo-hack](https://github.com/taiki-e/cargo-hack) and [cargo-all-features](https://github.com/frewsxcv/cargo-all-features) that allow you to test all combinations of features which can help reduce the amount of configuraton needed. From 3ac679599aa8b0b82986199473cc9117dfcb7d53 Mon Sep 17 00:00:00 2001 From: Yoav Lavi Date: Tue, 3 May 2022 13:36:15 +0200 Subject: [PATCH 2/2] Update features.md --- src/doc/src/reference/features.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/src/reference/features.md b/src/doc/src/reference/features.md index 057a3bef311..cc86698d590 100644 --- a/src/doc/src/reference/features.md +++ b/src/doc/src/reference/features.md @@ -514,8 +514,8 @@ source and inspect it. [`cargo vendor`]: ../commands/cargo-vendor.md [cargo-clone-crate]: https://crates.io/crates/cargo-clone-crate -### Caveats +### Feature combinations -Features, which are a form of conditional compilation, require an exponential number of configurations and test cases to be 100% covered. By default, testing, linting, Miri, docs and others will only run on the default set of features. +Because features are a form of conditional compilation, they require an exponential number of configurations and test cases to be 100% covered. By default, tests, docs, and other tooling such as [Clippy](https://github.com/rust-lang/rust-clippy) will only run with the default set of features. -There are certain tools like [cargo-hack](https://github.com/taiki-e/cargo-hack) and [cargo-all-features](https://github.com/frewsxcv/cargo-all-features) that allow you to test all combinations of features which can help reduce the amount of configuraton needed. +We encourage you to consider your strategy and tooling in regards to different feature combinations - Every project will have different requirements in conjunction with time, resources, and the cost-benefit of covering specific scenarios. Common configurations may be with / without default features, specific combinations of features, or all combinations of features.