|
config.initial_rustfmt = config.initial_rustfmt.or_else({ |
|
let build = config.build; |
|
let initial_rustc = &config.initial_rustc; |
|
|
|
move || { |
|
// Cargo does not provide a RUSTFMT environment variable, so we |
|
// synthesize it manually. |
|
let rustfmt = initial_rustc.with_file_name(exe("rustfmt", build)); |
|
|
|
if rustfmt.exists() { Some(rustfmt) } else { None } |
|
} |
|
}); |
The proper fix is to check if we're going through the cargo run entrypoint instead of x.py, and if so, download rustfmt from the nightly toolchain listed in src/stage0.json:
|
"rustfmt": { |
|
"date": "2022-02-23", |
|
"version": "nightly" |
|
}, |
Ideally we would eventually be able to move this into rustup, but that requires not only for rustup to add and release this feature, but also for all contributors to start using it. It shouldn't be too much extra work for bootstrap to do it itself in the meantime.
cc #94829, #94806 (comment), #94830 (comment)
rust/src/bootstrap/config.rs
Lines 1095 to 1106 in c7ce69f
The proper fix is to check if we're going through the
cargo runentrypoint instead of x.py, and if so, download rustfmt from the nightly toolchain listed insrc/stage0.json:rust/src/stage0.json
Lines 8 to 11 in c7ce69f
Ideally we would eventually be able to move this into rustup, but that requires not only for rustup to add and release this feature, but also for all contributors to start using it. It shouldn't be too much extra work for bootstrap to do it itself in the meantime.
cc #94829, #94806 (comment), #94830 (comment)