Repository: lettre/lettre (language: rust)

Issue:
Doesn't work with `tokio1-rustls-tls`
It compiles, but panics on `send` with: `thread 'main' panicked at 'built without the tokio1-native-tls feature'`.

It chooses second branch here instead of the third one: https://github.com/lettre/lettre/blob/master/src/transport/smtp/client/tls.rs#L138

We can fix it by changing that branching logic, buy it seems like `native-tls` shouldn't be among default features as there's a lot of other configuration rely on it. Though for now removing it breaks the tests.

The bug persists in both release and master branches. The hot-fix is `default-features = false`.



Discussion / hints:

Fix patch:
diff --git a/src/transport/smtp/client/tls.rs b/src/transport/smtp/client/tls.rs
index ed5d1e363..b5d0cb07d 100644
--- a/src/transport/smtp/client/tls.rs
+++ b/src/transport/smtp/client/tls.rs
@@ -128,18 +128,12 @@ impl TlsParametersBuilder {
     /// depending on which one is available
     #[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
     #[cfg_attr(docsrs, doc(cfg(any(feature = "native-tls", feature = "rustls-tls"))))]
-    // TODO: remove below line once native-tls is supported with async-std
-    #[allow(unreachable_code)]
     pub fn build(self) -> Result<TlsParameters, Error> {
-        // TODO: remove once native-tls is supported with async-std
-        #[cfg(all(feature = "rustls-tls", feature = "async-std1"))]
+        #[cfg(feature = "rustls-tls")]
         return self.build_rustls();
 
-        #[cfg(feature = "native-tls")]
+        #[cfg(not(feature = "rustls-tls"))]
         return self.build_native();
-
-        #[cfg(not(feature = "native-tls"))]
-        return self.build_rustls();
     }
 
     /// Creates a new `TlsParameters` using native-tls with the provided configuration


Test patch: