Valeriy Kazantsev
Valeriy Kazantsev

Reputation: 103

Does cargo always use the latest compiler_builtins?

I am building some bare-metal code for which I only need libcore and compiler_builtins. I am also building my own rustc, since I'm on a non-supported target architecture - and I think I made my changes to the latest stable rustc 1.60.0 instead of a nightly.

Apparently the latest available compiler_builtins 0.1.72 is not compatible with rustc 1.60.0 since it depends on something that's not been stabilized yet, e.g. this feature.

I thought that I would revert to a previous version of compiler_builtins, however cargo still insists on fetching the latest v0.1.72 from github, and now it's building both!

$ cat Cargo.toml 
...
[dependencies]
[target.arc-pc-unknown-gnu.dependencies]
core = { version = "0.0.0", path = "/home/valeriyk/proj/rust-arc/1.60.0/library/core"}
#compiler_builtins = { git = "https://github.com/rust-lang/compiler-builtins"}
compiler_builtins = "0.1.70"
$ cat .cargo/config.toml 
[unstable]
build-std = [
    "core",
    "compiler_builtins"
]
build-std-features = ["compiler-builtins-mem"]

[build]
target = "arc-pc-unknown-gnu"
$ cargo check
   Compiling compiler_builtins v0.1.70
   Compiling core v0.0.0 (/home/valeriyk/proj/rust-arc/1.60.0/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.72
   Compiling rustc-std-workspace-core v1.99.0 (/home/valeriyk/proj/rust-arc/1.60.0/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/rustc-std-workspace-core)
    Checking core v0.0.0 (/home/valeriyk/proj/rust-arc/1.60.0/library/core)
error[E0412]: cannot find type `c_char` in module `core::ffi`
  --> /home/valeriyk/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.72/src/mem/mod.rs:74:58

Is there a way to tell cargo not to use the latest builtins and stick to what's explicitly mentioned in Cargo.toml?

Upvotes: 1

Views: 934

Answers (1)

Valeriy Kazantsev
Valeriy Kazantsev

Reputation: 103

This comment suggests that it's not possible today.

To solve the issue I needed to upgrade to the latest nightly and re-aply all my changes.

Upvotes: 2

Related Questions