rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.65k stars 12.75k forks source link

Don't build rustc_middle for `x.py build src/tools/rustfmt` #82206

Open jyn514 opened 3 years ago

jyn514 commented 3 years ago

Rustfmt only depends on the parser, not type checking, and building rustc_middle greatly increases the time it takes to build.

$ x.py build --stage 0 src/tools/rustfmt
Updating only changed submodules
Submodules updated in 0.01 seconds
   Compiling bootstrap v0.0.0 (/home/joshua/rustc2/src/bootstrap)
    Finished dev [unoptimized + debuginfo] target(s) in 12.04s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.15s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_middle v0.0.0 (/home/joshua/rustc2/compiler/rustc_middle)
   Building [=====================>   ] 195/217: rustc_middle  
Mark-Simulacrum commented 3 years ago

While true, it's not clear to me that we expect people to build rustfmt in tree much since it's a submodule, and I think this would increase complexity in an unfortunate way with bootstrap's current architecture based on my expectation for what it would take; I'd prefer not to do it without stronger justification.

jyn514 commented 3 years ago

While true, it's not clear to me that we expect people to build rustfmt in tree much since it's a submodule, and I think this would increase complexity in an unfortunate way with bootstrap's current architecture based on my expectation for what it would take; I'd prefer not to do it without stronger justification.

I'm hoping to make rustfmt a subtree instead of a submodule: https://github.com/rust-lang/rust/pull/82208. See today's discussion in #dev-tools: https://discord.com/channels/442252698964721669/459149107387170817/811347550660722749

jyn514 commented 3 years ago

I think this would increase complexity in an unfortunate way with bootstrap's current architecture based on my expectation for what it would take

This is true, but I was hoping to make a similar change at some point anyway so you can e.g. run x.py build library/core and not build libstd.