prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
311 stars 113 forks source link

Using "rustls" feature results in a plethora of errors... #317

Open brsnik opened 9 months ago

brsnik commented 9 months ago

I get all these errors when I use the "rustls" feature. Am I doing something wrong?

error[E0428]: the name `create_tls_stream` is defined multiple times
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:31:1
   |
23 | / pub(crate) async fn create_tls_stream<S: AsyncRead + AsyncWrite + Unpin + Send>(
24 | |     config: &Config,
25 | |     stream: S,
26 | | ) -> crate::Result<TlsStream<S>> {
27 | |     TlsStream::new(config, stream).await
28 | | }
   | |_- previous definition of the value `create_tls_stream` here
...
31 | / pub(crate) async fn create_tls_stream<S: AsyncRead + AsyncWrite + Unpin + Send>(
32 | |     config: &Config,
33 | |     stream: S,
34 | | ) -> crate::Result<TlsStream<S>> {
35 | |     native_tls_stream::create_tls_stream(config, stream).await
36 | | }
   | |_^ `create_tls_stream` redefined here
   |
   = note: `create_tls_stream` must be defined only once in the value namespace of this module
error[E0252]: the name `TlsStream` is defined multiple times
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:17:16
   |
14 | pub(crate) use native_tls_stream::TlsStream;
   |                ---------------------------- previous import of the type `TlsStream` here
...
17 | pub(crate) use rustls_tls_stream::TlsStream;
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TlsStream` reimported here
   |
   = note: `TlsStream` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
   |
17 | pub(crate) use rustls_tls_stream::TlsStream as OtherTlsStream;
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0624]: associated function `new` is private
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:27:16
   |
27 |     TlsStream::new(config, stream).await
   |                ^^^ private associated function
   |
  ::: /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-native-tls-0.4.0/src/tls_stream.rs:23:5
   |
23 |     pub(crate) fn new(stream: native_tls::TlsStream<StdAdapter<S>>) -> Self {
   |     ----------------------------------------------------------------------- private associated function defined here
error[E0061]: this function takes 1 argument but 2 arguments were supplied
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:27:5
   |
27 |     TlsStream::new(config, stream).await
   |     ^^^^^^^^^^^^^^         ------ unexpected argument of type `S`
   |
note: expected `TlsStream<StdAdapter<_>>`, found `&Config`
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:27:20
   |
27 |     TlsStream::new(config, stream).await
   |                    ^^^^^^
   = note: expected struct `native_tls::TlsStream<async_native_tls::std_adapter::StdAdapter<_>>`
           found reference `&config::Config`
note: associated function defined here
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-native-tls-0.4.0/src/tls_stream.rs:23:19
   |
23 |     pub(crate) fn new(stream: native_tls::TlsStream<StdAdapter<S>>) -> Self {
   |                   ^^^
help: remove the extra argument
   |
27 -     TlsStream::new(config, stream).await
27 +     TlsStream::new(/* stream */).await
   |
error[E0277]: `async_native_tls::TlsStream<_>` is not a future
  --> /Users//.cargo/registry/src/index.crates.io-6f17d22bba15001f/tiberius-0.12.2/src/client/tls_stream.rs:27:35
   |
27 |     TlsStream::new(config, stream).await
   |     ------------------------------^^^^^^
   |     |                             |
   |     |                             `async_native_tls::TlsStream<_>` is not a future
   |     |                             help: remove the `.await`
   |     this call returns `async_native_tls::TlsStream<_>`
   |
   = help: the trait `futures_util::Future` is not implemented for `async_native_tls::TlsStream<_>`
   = note: async_native_tls::TlsStream<_> must be a future or must implement `IntoFuture` to be awaited
   = note: required for `async_native_tls::TlsStream<_>` to implement `std::future::IntoFuture`
Timotej commented 9 months ago

You probably need to disable default features in cargo.toml and then enable rustls. By default native-tls is enabled and what you see is probably conflict between two enabled tls implememtations.