Skip to content

Clippy is incompatible with serde 1.0.107 #8378

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

Closed
kornelski opened this issue Jan 31, 2022 · 1 comment · Fixed by #8586
Closed

Clippy is incompatible with serde 1.0.107 #8378

kornelski opened this issue Jan 31, 2022 · 1 comment · Fixed by #8586
Labels
A-infra Area: CI issues and issues that require full access for GitHub/CI E-help-wanted Call for participation: Help is requested to fix this issue. good first issue These issues are a good way to get started with Clippy

Comments

@kornelski
Copy link
Contributor

kornelski commented Jan 31, 2022

Summary

Re #7606

The version of serde specified in Cargo.toml is too low, and incompatible with this crate.

test compile_test ... FAILED

failures:

---- compile_test stdout ----
diff of stderr:

 error[E0412]: cannot find type `PhantomData` in this scope
   --> $DIR/ice-6252.rs:8:9
    |
 LL |     _n: PhantomData,
    |         ^^^^^^^^^^^ not found in this scope
    |
 help: consider importing one of these items
    |
 LL | use core::marker::PhantomData;
    |
-LL | use serde::__private::PhantomData;
+LL | use serde::export::PhantomData;
    |
 LL | use std::marker::PhantomData;
    |

 error[E0412]: cannot find type `VAL` in this scope
   --> $DIR/ice-6252.rs:10:63

Reproducer

Clippy asks for serde 1.0.0, which is even lower, but currently the lowest possible version is 1.0.107, because that's what cargo_metadata crate specifies, and this forces this version for the whole project (Cargo doesn't duplicate dependencies with the same semver-major version).

cargo update -p serde --precise 1.0.107
cargo test --all

The same tests pass if you do:

cargo update -p serde

to bump serde to 1.0.136. Somewhere between 107 and 136 serde has changed its behavior, and the tests rely on the later serde version.

Version

rustc 1.60.0-nightly (6abb6385b 2022-01-26)
binary: rustc
commit-hash: 6abb6385b2cb7249f67b9b3ce7522527767dd907
commit-date: 2022-01-26
host: aarch64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0

Additional Labels

No response

@kornelski kornelski added the C-bug Category: Clippy is not doing the correct thing label Jan 31, 2022
@flip1995
Copy link
Member

Continuing the conversation of #7606: I mean, Clippy doesn't have a Cargo.lock file, so running cargo update if something weird breaks with dependencies is usually the solution. This probably did break for you, because you had an outdated Cargo.lock file in your checkout.

We could set serde to 1.0.125, so that it at least uses that version. This is the version that is currently in rust-lang/rusts Cargo.lock file. Since we don't really care that much about the serde version in Clippy (as long as tests pass), I'd say we don't cause a serde version update in rust-lang/rust. We can set the minimum version to whatever works in the range of 1.0.108 and 1.0.125 though.

@flip1995 flip1995 added A-infra Area: CI issues and issues that require full access for GitHub/CI E-help-wanted Call for participation: Help is requested to fix this issue. good first issue These issues are a good way to get started with Clippy and removed C-bug Category: Clippy is not doing the correct thing labels Jan 31, 2022
@bors bors closed this as completed in e1ddf29 Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-infra Area: CI issues and issues that require full access for GitHub/CI E-help-wanted Call for participation: Help is requested to fix this issue. good first issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants