-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Investigate why named arguments in FormatSpec.precision seem to have indices that don't correspond to a span in Context.arg_spans #99266
Comments
@rustbot claim |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jul 29, 2022
…rrors Generate correct suggestion with named arguments used positionally Address issue rust-lang#99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue rust-lang#99265 also fixes issue rust-lang#99266. Fixes rust-lang#99265 Fixes rust-lang#99266
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Aug 11, 2022
Address issue rust-lang#99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue rust-lang#99265 also fixes issue rust-lang#99266. Fixes rust-lang#99265 Fixes rust-lang#99266
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Aug 11, 2022
…rrors Generate correct suggestion with named arguments used positionally Address issue rust-lang#99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue rust-lang#99265 also fixes issue rust-lang#99266. Fixes rust-lang#99265 Fixes rust-lang#99266
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As noted int #99263, named arguments in FormatSpec.precision seem to have indices that don't correspond to a span in Context.arg_spans. This caused an ICE with the
named_arguments_used_positionally
lint, which assumed the index in the FxHashSet for named arguments would correspond to the index forarg_spans
in context.Determine if this is a bug or if some sort of translation is necessary and update accordingly.
The text was updated successfully, but these errors were encountered: