Skip to content
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

Suggest a positional formatting argument instead of a captured argument #100058

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Aug 2, 2022

This patch fixes a part of #96999.

fixes #98241
fixes #97311

r? @estebank

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 2, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 2, 2022
@compiler-errors
Copy link
Member

Can you add tests for different format arg types, like Debug {:?} and {:#?}, and precision formatters like {:.3}?

@bors
Copy link
Contributor

bors commented Aug 2, 2022

☔ The latest upstream changes (presumably #100063) made this pull request unmergeable. Please resolve the merge conflicts.

@TaKO8Ki TaKO8Ki force-pushed the suggest-positional-formatting-argument-instead-of-format-args-capture branch from c01bb16 to a0a2ec3 Compare August 3, 2022 02:29
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Aug 3, 2022

@compiler-errors I added them!

let byte_pos = self.to_span_index(end);
let start = InnerOffset(byte_pos.0 + 1);
let field = self.argument(start);
if !self.consume('}') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment stating "We can only parse foo.bar field access, any deeper nesting, or another type of expression, like method calls, are not supported".

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks, r=me after addressing them.

@estebank
Copy link
Contributor

estebank commented Aug 4, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Aug 4, 2022

📌 Commit 8c85c99 has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 4, 2022
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#98796 (Do not exclusively suggest `;` when `,` is also a choice)
 - rust-lang#99772 (Re-enable submodule archive downloads.)
 - rust-lang#100058 (Suggest a positional formatting argument instead of a captured argument)
 - rust-lang#100093 (Enable unused_parens for match arms)
 - rust-lang#100095 (More EarlyBinder cleanups)
 - rust-lang#100138 (Remove more Clean trait implementations)
 - rust-lang#100148 (RustWrapper: update for TypedPointerType in LLVM)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d3aa757 into rust-lang:master Aug 4, 2022
@rustbot rustbot added this to the 1.64.0 milestone Aug 4, 2022
@TaKO8Ki TaKO8Ki deleted the suggest-positional-formatting-argument-instead-of-format-args-capture branch August 4, 2022 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
6 participants