Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fail with serde v1.0.122 #9101

Closed
tesuji opened this issue Jan 25, 2021 · 8 comments · Fixed by #9102
Closed

Compilation fail with serde v1.0.122 #9101

tesuji opened this issue Jan 25, 2021 · 8 comments · Fixed by #9102

Comments

@tesuji
Copy link
Contributor

tesuji commented Jan 25, 2021

How to reproduce ?

  • Check out this repo with latest commit: b52fc0a
  • Run: cargo update -p serde:1.0.122
  • Run cargo check in this repo

Error message:

error[E0283]: type annotations needed
   --> src/cargo/util/config/de.rs:530:63
    |
530 |                 seed.deserialize(Tuple2Deserializer(1i32, env.as_ref()))
    |                                                           ----^^^^^^--
    |                                                           |   |
    |                                                           |   cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                                                           this method call resolves to `&T`
    |
    = note: cannot satisfy `std::string::String: AsRef<_>`
help: use the fully qualified path for the potential candidates
    |
530 |                 seed.deserialize(Tuple2Deserializer(1i32, <std::string::String as AsRef<OsStr>>::as_ref(env)))
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
530 |                 seed.deserialize(Tuple2Deserializer(1i32, <std::string::String as AsRef<std::path::Path>>::as_ref(env)))
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
530 |                 seed.deserialize(Tuple2Deserializer(1i32, <std::string::String as AsRef<str>>::as_ref(env)))
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
530 |                 seed.deserialize(Tuple2Deserializer(1i32, <std::string::String as AsRef<[u8]>>::as_ref(env)))
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

cc rust-lang/rust#81327 (comment)

@RalfJung
Copy link
Member

Cc rust-lang/rust#81378

@RalfJung
Copy link
Member

Cc @dtolnay

@macalimlim
Copy link

I also got same error on a fresh installation of macos catalina...

Steps to reproduce

  1. Usual Rust environment setup thru rustup
  2. Run cargo install cargo-generate

cargo-generate-error

@tesuji
Copy link
Contributor Author

tesuji commented Jan 25, 2021

@macalimlim try cargo install --locked <package> instead.

@macalimlim
Copy link

@lzutao thanks that worked! 👍

@miketimofeev
Copy link

miketimofeev commented Jan 25, 2021

Same here, cargo-outdated installation fails on any OS — ubuntu, macOS, windows

2021-01-25T12:29:09.3660856Z error[E0283]: type annotations needed
2021-01-25T12:29:09.3662485Z    --> /home/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.50.0/src/cargo/util/config/de.rs:530:63
2021-01-25T12:29:09.3663348Z     |
2021-01-25T12:29:09.3663785Z 530 |                 seed.deserialize(Tuple2Deserializer(1i32, env.as_ref()))
2021-01-25T12:29:09.3664576Z     |                                                           ----^^^^^^--
2021-01-25T12:29:09.3665129Z     |                                                           |   |
2021-01-25T12:29:09.3665719Z     |                                                           |   cannot infer type for type parameter `T` declared on the trait `AsRef`
2021-01-25T12:29:09.3666558Z     |                                                           this method call resolves to `&T`
2021-01-25T12:29:09.3667021Z     |
2021-01-25T12:29:09.3667552Z     = note: cannot satisfy `std::string::String: AsRef<_>`

upd: Thanks @lzutao for the workaround!

@ehuss
Copy link
Contributor

ehuss commented Jan 25, 2021

Thanks for the report, I filed an issue with serde at serde-rs/serde#1967, but it looks like Alex already has a fix (so fast! 😄).

bors added a commit that referenced this issue Jan 25, 2021
Fix compilation with serde 1.0.122

This may or may not be a bug in serde, but let's commit a fix here first
in any case.

Closes #9101
@bors bors closed this as completed in f097d02 Jan 25, 2021
kornelski added a commit to crev-dev/cargo-crev that referenced this issue Jan 25, 2021
joshtriplett added a commit to joshtriplett/rust-libc that referenced this issue Jan 28, 2021
We don't, in general, want our CI to be the testbed for building
semverver with newer versions of its dependencies. Pass --locked to use
the checked-in Cargo.lock instead.

This works around rust-lang/cargo#9101 .
bors added a commit to rust-lang/libc that referenced this issue Jan 28, 2021
ci/semver.sh: Pass --locked when installing semverver

We don't, in general, want our CI to be the testbed for building
semverver with newer versions of its dependencies. Pass --locked to use
the checked-in Cargo.lock instead.

This works around rust-lang/cargo#9101 .
@lu-zero
Copy link
Contributor

lu-zero commented Jan 29, 2021

Can we have a point release with the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants