blackbeam / rust-mysql-simple

Mysql client library implemented in rust.
Apache License 2.0
661 stars 144 forks source link

unable to use default-rustls feature #363

Closed evbo closed 6 months ago

evbo commented 11 months ago

If I use the following feature:

mysql = { version = "24.0.0", features = ["default-rustls"] }

my build fails with:

error[E0428]: the name Secure is defined multiple times --> /home/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-24.0.0/src/io/mod.rs:169:5 167 Secure(BufStream<native_tls::TlsStream>), -------------------------------------------------------- previous definition of the type Secure here 168 #[cfg(feature = "rustls")] 169 Secure(BufStream<rustls::StreamOwned<rustls::ClientConnection, net::TcpStream>>), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure redefined here

= note: Secure must be defined only once in the type namespace of this enum

error[E0252]: the name ClientIdentity is defined multiple times --> /home/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-24.0.0/src/conn/opts/mod.rs:32:9 29 pub use native_tls_opts::ClientIdentity; ------------------------------- previous import of the type ClientIdentity here ... 32 pub use rustls_opts::ClientIdentity; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ClientIdentity reimported here

= note: ClientIdentity 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 | 32 | pub use rustls_opts::ClientIdentity as OtherClientIdentity; | ~~~~~~~~~~

error[E0252]: the name TlsError is defined multiple times --> /home/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-24.0.0/src/error/tls/mod.rs:10:9 7 pub use native_tls_error::TlsError; -------------------------- previous import of the type TlsError here ... 10 pub use rustls_error::TlsError; ^^^^^^^^^^^^^^^^^^^^^^ TlsError reimported here

= note: TlsError 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 | 10 | pub use rustls_error::TlsError as OtherTlsError; | ~~~~~~~~~~~

error[E0592]: duplicate definitions with name make_secure --> /home/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-24.0.0/src/io/tls/native_tls_io.rs:17:5 17 pub fn make_secure(self, host: url::Host, ssl_opts: SslOpts) -> Result { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for make_secure

::: /home/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-24.0.0/src/io/tls/rustls_io.rs:23:5 | 23 | pub fn make_secure(self, host: url::Host, ssl_opts: SslOpts) -> Result { | ------------------------------------------------------------------------------ other definition for make_secure

The build successfully finishes if instead I use:

mysql = { version = "24.0.0", default-features = false, features = ["rustls-tls"] }
flate2 = { version = "*", default-features = false, features = ["rust_backend"] }
blackbeam commented 11 months ago

Hi. default-rustls conflicts with the default set of features, so you have to set default-features = false (also note, that it is necessary to choose the flate2 backend if it is not chosen by your feature set)