Ldap3 throws mismatched types error

ldap3 - version 0.6.1

i get this error while building my project. It used to work properly previouly i hit this error since the latest changes ldap3 crate.

mismatched types
--> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/ldap3-0.6.1/src/controls_impl/assertion.rs:33:28

       write::encode_into(&mut buf, filter).expect("encoded");

| ^^^^^^^^ expected struct bytes::bytes_mut::BytesMut, found struct bytes::BytesMut

= note: expected type &mut bytes::bytes_mut::BytesMut
found type &mut bytes::BytesMut

Any help is appreciated.

ldap3 relies on bytes version 0.4.x. What version are you using?

I have not specified any version of bytes in my project I only metioned ldap3 = "0.6.1" in my Cargo.toml.

When i check my cargo.lock i see this for lber and ldap
name = "lber"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",

name = "ldap3"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lber 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",

It seems like you have dependencies on two crates that use different versions of bytes. The error you're seeing is that you can't use a Bytes from 0.4.x with one from 0.5.x.

Ya i got it I was able to figure that but I am having difficulty to resolve this mutliple dependency.

ldap3 - 0.6.1 is depending on lber whose previous version 0.1.6 (which used bytes 0.4.1) but recently the lber is bumped to 0.1.7 (which uses bytes 0.5).


Could you point me where I need to fix

Yes, lber is tripping you up with the different version of bytes. Try specifying lber = "=0.1.6" in your Cargo.toml. I'll try to fix it later.

Thanks @inejge it works. Thanks @alice

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.