-
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
make "invalid fragment specifier" translatable #121067
Conversation
rustbot has assigned @michaelwoerister. Use r? to explicitly pick a reviewer |
sess.dcx().emit_err( | ||
errors::InvalidFragmentSpecifier { | ||
span, | ||
name: frag.name.to_string(), |
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.
Could you pass Ident
directly here (and ofc update InvalidFragmentSpecifier
)?
name: frag.name.to_string(), | |
name: frag, |
This way, we would properly print invalid fragment specifier `r#async`
instead of invalid fragment specifier `async`
for:
macro_rules! m { ($x:r#async) => {} }
(and avoid an allocation but that doesn't really matter since we're in the error path)
this would still display |
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.
Thanks! Could you squash the commits into one?
Did you test that with Maybe |
I used an existing test to check, and I see using |
c19eab1
to
00530bc
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.
We already have tests for invalid fragment specifiers, e.g., tests/ui/macros/macro-invalid-fragment-spec.rs
. Actually instead of modifying this old test file, could you just remove it in favor of the new one you just added. I like your test file way better. After that, we're good to go!
Also replaces an incomplete test
00530bc
to
e3859d2
Compare
Thanks! |
… r=fmease make "invalid fragment specifier" translatable
… r=fmease make "invalid fragment specifier" translatable
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#121067 (make "invalid fragment specifier" translatable) - rust-lang#121079 (distribute tool documentations and avoid file conflicts on `x install`) - rust-lang#121230 (Extend Level API) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#118569 (Move `OsStr::slice_encoded_bytes` validation to platform modules) - rust-lang#121067 (make "invalid fragment specifier" translatable) - rust-lang#121224 (Remove unnecessary unit binding) - rust-lang#121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`) - rust-lang#121257 (remove extraneous text from example config) - rust-lang#121260 (Remove const_prop.rs) - rust-lang#121266 (Add uncontroversial syscall doc aliases to std docs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121067 - tshepang:make-expand-translatable, r=fmease make "invalid fragment specifier" translatable
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#118569 (Move `OsStr::slice_encoded_bytes` validation to platform modules) - rust-lang#121067 (make "invalid fragment specifier" translatable) - rust-lang#121224 (Remove unnecessary unit binding) - rust-lang#121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`) - rust-lang#121257 (remove extraneous text from example config) - rust-lang#121260 (Remove const_prop.rs) - rust-lang#121266 (Add uncontroversial syscall doc aliases to std docs) r? `@ghost` `@rustbot` modify labels: rollup
No description provided.