rust-lang / cargo-bisect-rustc

Bisects rustc, either nightlies or CI artifacts
https://rust-lang.github.io/cargo-bisect-rustc/
Apache License 2.0
178 stars 55 forks source link

Using `--target` causes two toolchains to be downloaded for each snapshot #338

Closed mqudsi closed 6 months ago

mqudsi commented 6 months ago

I am trying to do an llvm ir regression bisection that reproduces without the standard library and without a binary. I can manually use cargo --target x86_64-unknown rustc --release -- -C opt-level=3 -C debuginfo=0 -C target-cpu=x86-64 --emit=llvm-ir to generate the .ll file I need to inspect with a #![no_main] #![no_std] src/lib.rs file.

But when I use

cargo bisect-rustc --start=1.69.0 --end=1.71.0 --script bisect.sh --target=x86_64-unknown-none

I watch it download and install the x86_64-unknown-linux-gnu target/toolchain then the x86_64-unknown-none toolchain/target for each nightly.

ehuss commented 6 months ago

Unless I am misunderstanding you, this is the expected behavior. It needs to download the host rustc (x86_64-unknown-linux-gnu) along with its standard library, and then the target (x86_64-unknown-none) standard library. Host toolchains don't exist for -none targets, so I'm guessing you may be referring to the rust-std-nightly-x86_64-unknown-none download, which is the "standard library" for the requested target. It needs to also download the standard library for the host toolchain to handle proc-macros and cargo build scripts.

mqudsi commented 6 months ago

Hey thanks for the speedy reply.

I didn't realize you necessarily needed the host toolchain if you're strictly "cross-compiling" for the explicit target, but that makes sense once I stop and think about it.

rust-std-nightly-x86_64-unknown-none download, which is the "standard library" for the requested target

I guess I am curious what actually gets downloaded for rust-std-nightly-x86_64-unknown-none given that x86_64-unknown-none doesn't have a standard library and is a no_std-only target, though?

ehuss commented 6 months ago

"standard library" is an umbrella term that refers to std, alloc, core, proc_macro, test, etc. no_std targets are just those missing the std crate.