-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
I've encountered a strange issue today.
Background: The percent-encoding crate recently made a new major release. Knowing that stuff could break I held off on updating the crate because I haven't yet had time to check what changed.
Problem
When I compile my binary crate using cargo build (with and without --release) everything builds fine. However, if I compile my binary using cargo install --path . -f, compilation fails with an error related to percent-encoding (the breaking change warranting the major version bump I assume..). In the output I see that it compiled percent-encoding v2.0.0 instead of percent-encoding v1.0.1 as specified in Cargo.lock. (Note: The Cargo.toml doesn't specify a specific version.)
The crate is the following, if you want to try at home:
https://github.com/df5602/bingers
Steps
$ cargo clean$ cargo build
...
Compiling percent-encoding v1.0.1
...
Finished dev [unoptimized + debuginfo] target(s) in 48.32s
$ cargo build --release
...
Compiling percent-encoding v1.0.1
...
Finished release [optimized] target(s) in 1m 25s
$ cargo install --path . -f
Installing bingers v0.1.0 (/path/to/bingers)
Updating crates.io index
Compiling percent-encoding v2.0.0
Compiling bingers v0.1.0 (/path/to/bingers)
error[E0432]: unresolved import `percent_encoding::QUERY_ENCODE_SET`
--> src/tvmaze_api.rs:10:45
|
10 | use percent_encoding::{utf8_percent_encode, QUERY_ENCODE_SET};
| ^^^^^^^^^^^^^^^^ no `QUERY_ENCODE_SET` in the root
error: aborting due to previous error
I can work around it by specifying an explicit version in Cargo.toml, but the observed behaviour was surprising to me...
Notes
Output of cargo version:
cargo 1.36.0 (c4fcfb725 2019-05-15)
OS: Mac