I am new to Rust. So, in order to dive in, I decided to make a Bluetooth application as my first project. (What could be easier? Yes, I'm being sarcastic). I saw a bluez 0.3.1 available on crates.io. So I tried something similar to:
$ cargo new foo $ cd foo $ echo 'bluez = "0.3.1"' >> Cargo.toml $ cargo build
But when I attempted to build this, I got an error similar to:
$ cargo build ... error: aborting due to 60 previous errors Some errors have detailed explanations: E0034, E0308. For more information about an error, try `rustc --explain E0034`. error: could not compile `bitvec` To learn more, run the command again with --verbose. warning: build failed, waiting for other jobs to finish... error: build failed
The errors seemed to be related to some incompatibility between bitvec-0.20.1 and funty-1.2.0, whatever those are.
So I cloned my own copy of the bluez crate and attempted to build it... it built fine. (Of course!)
I saw that there is a newer version of bitvec available, so I tried changing
bitvec = "0.20"
bitvec = "0.21"
and saw the same sort of error. Then I asked the Google and found https://github.com/bitvecto-rs/bitvec/issues/105, which advised using funty 1.1.0. I changed the Cargo.toml file in bluez-rs to specify funty 1.1.0, and successfully built.
Then I pointed Cargo.toml to my custom version of bluez-rs and was able to build.
That's the long story. Here's my question: Should this have been this hard? I thought that crates dot io preserved old revisions so that older code wouldn't fail to build. Is there some way I could have told my project to use funty 1.1.0 instead of 1.2.0? I tried putting that in my Cargo.toml file, and it still built 1.2.0. I guess I'm just confused and would appreciate any tips on the best way to address problems like this if I run into them again in the future.