-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Lint against escape sequences in Fluent files #109700
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
5e7c29b
to
c812cdd
Compare
Actually, might this make more sense to do during compiling? |
I think this could happen during compilation and doesn't need to be a tidy check, yeah. |
c812cdd
to
c0ac839
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, glad that this was able to find regressions in the existing diagnostics.
r=me -- if you want to add a test, or not that's also probably ok @bors delegate+ |
✌️ @clubby789 can now approve this pull request |
c0ac839
to
979c265
Compare
@bors r=compiler-errors |
LL | fluent_messages! { "./invalid-escape.ftl" } | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: os-specific message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit interesting, it's caused by // normalize-stderr-test "note.*" -> "note: os-specific message"
in test.rs. It was added because the "could not open Fluent resource" error contains an OS specific error as the note. I think it would be nice if this replacement didn't affect this error.
To give two suggestions how to address this, either one could extend the note of the "could not open" error to something that a better pattern can be made for, or one could move that error into a different file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a PR: #109798
One can use fluent quoted strings to avoid the check, if needed: For |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#107387 (Use random `HashMap` keys on Hermit) - rust-lang#109511 (Make `EvalCtxt`'s `infcx` private) - rust-lang#109554 (Suggest ..= when someone tries to create an overflowing range) - rust-lang#109675 (Do not consider elaborated projection predicates for objects in new solver) - rust-lang#109693 (Remove ~const from alloc) - rust-lang#109700 (Lint against escape sequences in Fluent files) - rust-lang#109716 (Move `mir::Field` → `abi::FieldIdx`) - rust-lang#109726 (rustdoc: Don't strip crate module) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
fluent_messages macro: don't emit the OS error in a note This makes it possible to make the normalization of the error message precise, allowing us to not normalize all notes away. See rust-lang#109700 (comment)
Fixes #109686 by checking for
\n
,\"
and\'
in Fluent files. It might be useful to have a way to opt out of this check, but all messages with violations currently do seem to be incorrect.