Skip to content

E0460 long description is too optimistic about cargo's abilities #110120

Open
@jyn514

Description

@jyn514

Location

implementation-specific way. Note that this error can *only* occur when
directly compiling and linking with `rustc`; [Cargo] automatically resolves
dependencies, without using the compiler's own dependency management that
causes this issue.
This error can be fixed by:
* Using [Cargo], the Rust package manager, automatically fixing this issue.

Summary

This makes the claim "using cargo will automatically fix your problem". This is unfortunately not true. Consider the following error found while working on #81930:

error[E0460]: found possibly newer version of crate `core` which `itoa` depends on
   --> /home/jyn/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.85/src/number.rs:295:49
    |
295 |             N::PosInt(u) => formatter.write_str(itoa::Buffer::new().format(u)),
    |                                                 ^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
            crate `core`: /home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-5670a3f7cd4c9169.rmeta
            crate `itoa`: /home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps/libitoa-c25ddfbc66feadac.rmeta

All the dependencies involved here were compiled by cargo, but the error still appears. I am currently trying to figure out why; I think it's related to rebuilding the sysroot, but cargo not noticing that it needs to recompile a crate that depends on core? Maybe rustc needs to add a dependency edge to the .d files it emits?

cc #76720 (comment), @Ezrashaw

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-error-codesArea: Explanation of an error code (--explain)T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions