Skip to content

Check if format argument is identifier to avoid error err-emit - #140286

Merged
bors merged 3 commits into
rust-lang:masterfrom
xizheyin:issue-139104
May 4, 2025
Merged

Check if format argument is identifier to avoid error err-emit#140286
bors merged 3 commits into
rust-lang:masterfrom
xizheyin:issue-139104

Conversation

@xizheyin

Copy link
Copy Markdown
Member

Fixes#139104

When argument is not an identifier, it should not be considered a field access. I checked this and if not emit an invalid format string error. I think we could do with a little finer error handling, I'll open an issue to track this down later.

The first commit submits the ui test, the second commits the code and the changes to the test output.

r? compiler

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 25, 2025
@xizheyin
xizheyin marked this pull request as draft April 25, 2025 10:13
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Comment threadcompiler/rustc_parse_format/src/lib.rs Outdated
Comment threadcompiler/rustc_parse_format/src/lib.rs Outdated
@xizheyin
xizheyin marked this pull request as ready for review April 25, 2025 11:34
Comment threadtests/ui/parser/issues/invalid-parse-format-issue-139104.rs Outdated
Comment threadcompiler/rustc_parse_format/src/lib.rs Outdated
@xizheyin
xizheyinforce-pushed the issue-139104 branch 2 times, most recently from e2c6d0f to c63a4edCompareMay 3, 2025 14:35
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Comment threadcompiler/rustc_parse_format/src/lib.rs
Comment threadtests/ui/parser/issues/invalid-parse-format-issue-139104.rs
@lcnr

lcnr commented May 3, 2025

Copy link
Copy Markdown
Contributor

Thanks 👍

@bors r+ rollup

@bors

bors commented May 3, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 873ca5f has been approved by lcnr

It is now in the queue for this repository.

@borsbors 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 May 3, 2025
@ZalatharZalathar mentioned this pull request May 4, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2025
Rollup of 7 pull requests
Successful merges:
- rust-lang#139675 (Add the AVX10 target features)
- rust-lang#140286 (Check if format argument is identifier to avoid error err-emit)
- rust-lang#140456 (Fix test simd/extract-insert-dyn on s390x)
- rust-lang#140551 (Move some tests out of tests/ui)
- rust-lang#140588 (Adjust some ui tests re. target-dependent errors)
- rust-lang#140617 (Report the `unsafe_attr_outside_unsafe` lint at the closest node)
- rust-lang#140626 (allow `#[rustfmt::skip]` in combination with `#[naked]`)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 9c949b0 into rust-lang:masterMay 4, 2025
@rustbotrustbot added this to the 1.88.0 milestone May 4, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2025
Rollup merge of rust-lang#140286 - xizheyin:issue-139104, r=lcnr
Check if format argument is identifier to avoid error err-emit
Fixesrust-lang#139104
When `argument` is not an identifier, it should not be considered a field access. I checked this and if not emit an invalid format string error. I think we could do with a little finer error handling, I'll open an issue to track this down later.
The first commit submits the ui test, the second commits the code and the changes to the test output.
r? compiler
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid format string with certain fill characters yields incorrect suggestion

4 participants

@xizheyin@lcnr@bors@rustbot