-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
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 use rustfmt compiled with my changes in stage 1 and would therefore be able to parse the new syntax.
Command used
./x.py fmt --stage 1Expected 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)
# Includes one of the default files in src/bootstrap/defaults
profile = "compiler"
change-id = 137147Operating 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 fmtformats each file individually? Putting#![rustfmt::skip]infoo.rsalso 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 notanumbergives "invalid value 'notanumber' for '--stage ': invalid digit found in string" ↩