-
Notifications
You must be signed in to change notification settings - Fork 13.3k
./x.py fmt --stage 1
does not use stage 1 rustfmt
#140723
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
Comments
This is because |
Even if |
Hm yeah, even if we use a staged rustfmt locally, it still won't pass CI. AFAIK we kinda have to use a pre-compiled rustfmt consistently, otherwise different rustfmts can disagree on what's "properly formatted" 🤔 |
We don't need to use the in-tree rustfmt in CI; it's only for development purposes. With |
If CI accepts a change that the precompiled rustfmt doesn't accept, everyone will then be forced to use
This I agree with. It shouldn't silently be ignored. |
Yeah, I think we should error |
This doesn't have to happen. Like I said, it's only for developing/testing in-tree rustfmt, nothing related with CI here ( see #140732). |
In the case of OP it is not for developing/testing in-tree rustfmt but for actually using not yet supported syntax inside rustc or the standard library. For developing/testing in-tree rustfmt, maybe something like |
…Kobzol make it possible to run in-tree rustfmt with `x run rustfmt` Currently, there is no way to run in-tree `rustfmt` using `x fmt` or `x test tidy` commands. This PR implements `rustfmt` on `x run`, which allows bootstrap to run the in-tree `rustfmt`. Fixes rust-lang#140723
Summary
I made changes to the compiler to introduce new syntax (the specific syntax addition is not relevant to this issue). I added code to the stdlib using this syntax, but only inside of separate files guarded by
#[cfg(not(bootstrap))] mod foo;
so that the bootstrap compiler would not error on it (since it cannot parse it). I then did./x.py fmt
, which failed due to not being able to parse the new syntax in these files1. I then tried./x.py fmt --stage 1
, thinking it would userustfmt
compiled with my changes in stage 1 and would therefore be able to parse the new syntax.Command used
Expected behaviour
./x.py fmt --stage 1
should use stage 1 rustfmt, that contains my syntax changes to the compiler.Actual behaviour
./x.py fmt --stage 1
appears to validate the--stage
flag argument2, but seems to otherwise ignore the flag (./x.py fmt --stage 100
appears to do exactly the same thing as./x.py fmt
and./x.py fmt --stage 1
), so./x.py fmt --stage 1
does not use stage 1 rustfmt, and therefore cannot parse my custom syntax.Bootstrap configuration (bootstrap.toml)
Operating system
Ubuntu (Xubuntu) 24.04.2
HEAD
Custom fork off of 1a95cc6
Additional context
Build Log N/A
Footnotes
I tried putting
#[rustfmt::skip]
on themod foo;
to make it skip the file, which didn't work, I assume because./x.py fmt
formats each file individually? Putting#![rustfmt::skip]
infoo.rs
also doesn't work, since rustfmt can't parse the file to even be able to interpret the attribute to know to skip the file. ↩i.e.
./x.py fmt --stage notanumber
gives "invalid value 'notanumber' for '--stage ': invalid digit found in string" ↩The text was updated successfully, but these errors were encountered: