-
Notifications
You must be signed in to change notification settings - Fork 13.7k
warn on empty precision #136638
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
base: master
Are you sure you want to change the base?
warn on empty precision #136638
Conversation
rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
@bors try |
Please add a ui test for this |
error on empty precision Fixes rust-lang#131159 by erroring on missing precision. Alternatively we could document current behavior.
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
Given how many crates were broken in the crater run, I don't think we should change this. (See all the PRs referenced above.) Perhaps a warning is better. Or we can just document it. |
We discussed this in the libs-api meeting and decided that the best path forward would be a forward-compatibility warning which will give us the possibility of making this a hard error in the future. We definitely shouldn't make it an error immediately due to the widespread potential breakage. |
Probably this FCW should go ahead and just start by linting in deps. |
I'm not convinced that this needs a (forward-compatibility) warning. A default placeholder can be written as It seems that in every single occurence of |
I think a clippy lint would be reasonable, it's a needlessly complicated way to write |
The other option, of course, is to document the current behavior. We do get this right for format := '{' [ argument ] [ ':' format_spec ] [ ws ] * '}'
format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
type := '' | '?' | 'x?' | 'X?' | identifier So since format := '{' [ argument ] [ ':' format_spec ] [ ws ] * '}'
argument := integer | identifier
format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
precision := count | '*'
count := parameter | integer
parameter := argument '$' Here, this bottoms out at requiring something after the dot. We could say, instead, if we want, e.g.: precision := count | '*' | '' Since we do also accept today, e.g. format_spec := [[fill]align][sign]['#']['0'][width]['.' [precision]]type |
@hkBst any updates on this? thanks |
ef04c64
to
d7191ec
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
I don't think we should merge this, as I mentioned above:
I think instead we should fix the reference, as mentioned by @traviscross above: #136638 (comment) @rfcbot close |
Team member @m-ou-se has proposed to close this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This actually caught a bug, as I previously mentioned here: #136638 (comment) |
I think a clippy lint would be more appropriate. |
|
d7191ec
to
6b19589
Compare
@rustbot ready |
Fixes #131159 by
erroringwarning on missing precision. Alternatively we could document current behavior.