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

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

Open
jyn514 opened this issue Apr 9, 2023 · 4 comments
Open

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

jyn514 opened this issue Apr 9, 2023 · 4 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-error-codes Area: Explanation of an error code (--explain) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 9, 2023

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

@jyn514 jyn514 added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-error-codes Area: Explanation of an error code (--explain) labels Apr 9, 2023
@jyn514
Copy link
Member Author

jyn514 commented Apr 9, 2023

BTW the ASCII art in the long error was extremely helpful, thank you ❤️ that's how I figured out it might be related to rebuilding the sysroot.

@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Apr 9, 2023
@Ezrashaw
Copy link
Contributor

Ezrashaw commented Apr 9, 2023

Gah, I think I copied that statement from some other docs I wrote without really thinking about it. I do think that, generally speaking, cargo should alleviate these woes, just not in all cases it seems. Unfortunately, I'm not sure I'll be able to help that much with this (I just wrote the docs :P) but I'll have a go at getting this error with cargo outside of the compiler.

@jyn514
Copy link
Member Author

jyn514 commented Apr 9, 2023

I think it's going to be hard to replicate, you'll need to find some bug in the integration between rustc and cargo. "not rebuilding when crates in the sysroot are updated" is the only one I know of today, and that only happens with a third build orchestration tool touching the sysroot.

@Ezrashaw
Copy link
Contributor

Ezrashaw commented Apr 9, 2023

Yeah, so maybe the statement is true if you are just using cargo without bootstrap getting in the way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-error-codes Area: Explanation of an error code (--explain) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

2 participants