Skip to content

Commit 380befa

Browse files
committed
feat: fail build if both tls-native and tls-rustls are enabled
1 parent 3af737f commit 380befa

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ default = ["tls-rustls"]
3939
cli = ["merge", "clap"]
4040
merge = ["dep:merge"]
4141
clap = ["dep:clap"]
42-
# The tls-* features should be treated as mutually exclusive.
42+
# tls-native and tls-rustls are mutually exclusive.
4343
tls-native = ["reqwest/native-tls"]
4444
tls-rustls = ["reqwest/rustls-tls-native-roots"]
4545

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ This crate exposes a few features for controlling dependency usage:
5555
- **clap** - Enables a dependency on the `clap` crate and enables parsing from
5656
the commandline. *This feature is disabled by default*.
5757
- **tls-native** - Builds with native TLS support (i.e. link against system TLS
58-
library). This feature should be treated as mutually exclusive with
59-
`tls-rustls`. *This features is disabled by default*.
58+
library). *This feature is mutually exclusive with `tls-rustls` and it is
59+
disabled by default*.
6060
- **tls-rustls** - Builds with Rustls support (i.e. with bundled TLS library).
61-
This feature should be treated as mutually exclusive with `tls-native`. *This
62-
feature is enabled by default*.
61+
*This feature is mutually exclusive with `tls-native` and it is enabled by
62+
default*.
6363

6464
## Examples
6565

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ This crate exposes a few features for controlling dependency usage.
139139
#![allow(rustdoc::private_intra_doc_links)]
140140
#![allow(clippy::needless_raw_string_hashes)]
141141

142+
#[cfg(all(feature = "tls-native", feature = "tls-rustls "))]
143+
compile_error!("features \"tls-native\" and \"tls-rustls \" cannot be enabled at the same time. Please disable one of them.");
144+
142145
pub(crate) mod archiver;
143146
pub(crate) mod backend;
144147
pub(crate) mod blob;

0 commit comments

Comments
 (0)