oli-obk / cargo_metadata

MIT License
171 stars 92 forks source link

cargo_metadata 0.15.4 doesn't compile #247

Closed danandreicarp closed 1 year ago

danandreicarp commented 1 year ago

Hello,

I'm trying to install cargo-tarpaulin on a mac, but the installation fails when attempting to compile cargo_metadata. This is the error I'm seeing:

 Compiling cargo_metadata v0.15.4
error[E0507]: cannot move out of `*self` which is behind a shared reference
  --> /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/diagnostic.rs:95:24
   |
95 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
   |                        ^^^^^^^^^
   |                        |
   |                        data moved here
   |                        move occurs because `unrecognized` has type `Applicability`, which does not implement the `Copy` trait
   |
   = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
   |
95 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
   |                        +

error[E0507]: cannot move out of `*self` which is behind a shared reference
   --> /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/messages.rs:104:24
    |
104 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
    |                        ^^^^^^^^^
    |                        |
    |                        data moved here
    |                        move occurs because `unrecognized` has type `Message`, which does not implement the `Copy` trait
    |
    = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
    |
104 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
    |                        +

For more information about this error, try `rustc --explain E0507`.
error: could not compile `cargo_metadata` (lib) due to 2 previous errors

Is this a known issue? Is there a workaround?

Thank you!

dtolnay commented 1 year ago

This is a serde bug (https://github.com/serde-rs/serde/issues/2591). A fix has been published so it should work now if you give it another try.