-
Notifications
You must be signed in to change notification settings - Fork 7
prefer rustls for tls runtime and remove compilation error #288
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,16 +2,18 @@ use std::sync::Once; | |
|
|
||
| static TLS_INIT: Once = Once::new(); | ||
|
|
||
| #[cfg(all(feature = "tls-rustls", feature = "tls-native-tls"))] | ||
| compile_error!("features `tls-rustls` and `tls-native-tls` are mutually exclusive"); | ||
|
|
||
| #[cfg(not(any(feature = "tls-rustls", feature = "tls-native-tls")))] | ||
| compile_error!("one TLS feature must be enabled: `tls-native-tls` (default) or `tls-rustls`"); | ||
|
|
||
| /// Initializes TLS runtime defaults once for the current process. | ||
| /// | ||
| /// With `tls-native-tls` (default), this is a no-op. | ||
| /// With `tls-rustls`, installs the aws-lc-rs rustls provider. | ||
| /// | ||
|
Comment on lines
8
to
+12
|
||
| /// # Panics | ||
| /// | ||
| /// Panics if the `tls-rustls` feature is enabled and the aws-lc-rs | ||
| /// crypto provider fails to install. | ||
| pub fn ensure_tls_runtime() { | ||
| TLS_INIT.call_once(|| { | ||
| #[cfg(feature = "tls-rustls")] | ||
|
|
@@ -23,7 +25,7 @@ pub fn ensure_tls_runtime() { | |
| } | ||
| } | ||
|
|
||
| #[cfg(feature = "tls-native-tls")] | ||
| #[cfg(all(feature = "tls-native-tls", not(feature = "tls-rustls")))] | ||
| {} | ||
| }); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the mutual-exclusion
compile_error!was removed, enabling bothtls-native-tlsandtls-rustlsbecomes valid andtls-rustlseffectively wins. The current compile-time error text can be read as requiring exactly one TLS feature; consider clarifying it (e.g., “at least one TLS feature must be enabled; if both are enabled, rustls is used”).