Skip to content

Commit

Permalink
feat: fail build if both tls-native and tls-rustls are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jirutka committed Jan 5, 2024
1 parent 0a3007b commit b3d1668
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ default = ["tls-rustls"]
cli = ["merge", "clap"]
merge = ["dep:merge"]
clap = ["dep:clap"]
# The tls-* features should be treated as mutually exclusive.
# tls-native and tls-rustls are mutually exclusive.
tls-native = ["reqwest/native-tls"]
tls-rustls = ["reqwest/rustls-tls-native-roots"]

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ This crate exposes a few features for controlling dependency usage:
- **clap** - Enables a dependency on the `clap` crate and enables parsing from
the commandline. *This feature is disabled by default*.
- **tls-native** - Builds with native TLS support (i.e. link against system TLS
library). This feature should be treated as mutually exclusive with
`tls-rustls`. *This features is disabled by default*.
library). *This feature is mutually exclusive with `tls-rustls` and it is
disabled by default*.
- **tls-rustls** - Builds with Rustls support (i.e. with bundled TLS library).
This feature should be treated as mutually exclusive with `tls-native`. *This
feature is enabled by default*.
*This feature is mutually exclusive with `tls-native` and it is enabled by
default*.

## Examples

Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ This crate exposes a few features for controlling dependency usage.
#![allow(rustdoc::private_intra_doc_links)]
#![allow(clippy::needless_raw_string_hashes)]

#[cfg(all(feature = "tls-native", feature = "tls-rustls "))]
compile_error!("features \"tls-native\" and \"tls-rustls \" cannot be enabled at the same time. Please disable one of them.");

pub(crate) mod archiver;
pub(crate) mod backend;
pub(crate) mod blob;
Expand Down

0 comments on commit b3d1668

Please sign in to comment.