Solved! Could not compile `urlencoded`


#1

Hello,
have an issue compiling the urlencoded package,
opend an issue on GitHub after i had no search result, but until now get no response.

Cargo.toml
[dependencies]
iron = "0.2.2"
mime = "0.1.0"
router = "0.0.15"
urlencoded = “0.2.0”

As someone new to Rust it is hard to debug my own code rather than library code…
but i could locate the error in lib.rs
the trait plugin::Plugin<iron::request::Request<'_, '_>> is not implemented for the type bodyparser::Raw [E0277]at line 98 col 13

Here is a print of the build.

> $ cargo build                                                                                       
   Compiling urlencoded v0.2.1
/home/michael/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/urlencoded-0.2.1/src/lib.rs:98:13
: 98:16 error: the trait `plugin::Plugin<iron::request::Request<'_, '_>>` is not implemented for the type `bodyparser::Raw`

 [E0277]
/home/michael/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/urlencoded-0.2.1/src/lib.rs:98
      req.get::<bodyparser::Raw>()

          ^~~
/home/michael/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/urlencoded-0.2.1/src/lib.rs:98:13
: 98:16 help: run `rustc --explain E0277` to see a detailed explanation
/home/michael/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/urlencoded-0.2.1/src/lib.rs:98:13
: 98:16 help: the following implementations were found:
/home/michael/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/urlencoded-0.2.1/src/lib.rs:98:13
: 98:16 help:   <bodyparser::Raw as plugin::Plugin<iron::request::Request<'a, 'b>>>
error: aborting due to previous error
Could not compile `urlencoded`.

> $ cargo --version                                                                                   
cargo 0.9.0-nightly (8fc3fd8 2016-02-29)

rustc --version                                                                                    
rustc 1.8.0 (db2939409 2016-04-11)

thanks in advance regards


#2

It looks like urlencoded v0.2.1 had an incorrect Cargo.toml, so it ends up using the wrong version of the bodyparser crate. It looks like this issue is solved in urlencoded v0.3. If you’re stuck using v0.2.1 for whatever reason, you might be able to work around the issue by messing with your Cargo.lock file to force the correct version of bodyparser.


#3

Thanks @eefriedman
i tried before
[dependencies]
iron = ""
mime = "
"
router = “"
urlencoded = "

and
cargo build
but nothing updated in Cargo.lock, so i thought it were the last releases…

but after your hint i removed
Cargo.lock file and
$ cargo run

now it works fine!
Thanks a lot!