Skip to content

Conversation

tyrone-wu
Copy link
Contributor

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: #133083


I made a comment about the format of the diagnostic error message in #133083 (comment). I think the .label may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire TyKind::BareFn span. If it makes sense, I can include it in this PR.

@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2024

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot 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 Nov 18, 2024
@bors
Copy link
Collaborator

bors commented Jan 15, 2025

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

@compiler-errors
Copy link
Member

Can you rebase this? Sorry, this looks good but it needs updating.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2025
Trim extra whitespace when suggesting removal of invalid qualifiers when
parsing function pointer type.

Fixes: rust-lang#133083

Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
@tyrone-wu tyrone-wu force-pushed the trim-fn-ptr-whitespace branch from d67caa6 to 5082fd8 Compare January 27, 2025 17:18
@tyrone-wu
Copy link
Contributor Author

The branch should be updated now. 🫡 Let me know if there's anything else you'd like me to address!

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 27, 2025
@tyrone-wu tyrone-wu marked this pull request as ready for review January 27, 2025 18:13
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 27, 2025
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 27, 2025

📌 Commit 5082fd8 has been approved by compiler-errors

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 Jan 27, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 28, 2025
…r=compiler-errors

Trim extra whitespace in fn ptr suggestion span

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: rust-lang#133083

---

I made a comment about the format of the diagnostic error message in rust-lang#133083 (comment). I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#133929 (Remove -Zinline-in-all-cgus and clean up tests/codegen-units/)
 - rust-lang#134290 (Windows x86: Change i128 to return via the vector ABI)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#136012 (Document powf and powi values that are always 1.0)
 - rust-lang#136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - rust-lang#136117 (Subtree update of `rust-analyzer`)
 - rust-lang#136143 (Update books)
 - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 28, 2025
…r=compiler-errors

Trim extra whitespace in fn ptr suggestion span

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: rust-lang#133083

---

I made a comment about the format of the diagnostic error message in rust-lang#133083 (comment). I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#134290 (Windows x86: Change i128 to return via the vector ABI)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#136012 (Document powf and powi values that are always 1.0)
 - rust-lang#136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - rust-lang#136143 (Update books)
 - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 28, 2025
…r=compiler-errors

Trim extra whitespace in fn ptr suggestion span

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: rust-lang#133083

---

I made a comment about the format of the diagnostic error message in rust-lang#133083 (comment). I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#133929 (Remove -Zinline-in-all-cgus and clean up tests/codegen-units/)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#135961 (Fix 2/4 tests skipped by opt-dist)
 - rust-lang#136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - rust-lang#136124 (Arbitrary self types v2: explain test.)
 - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 28, 2025
…r=compiler-errors

Trim extra whitespace in fn ptr suggestion span

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: rust-lang#133083

---

I made a comment about the format of the diagnostic error message in rust-lang#133083 (comment). I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#133829 (Implement `AtomicT::update` & `AtomicT::try_update`)
 - rust-lang#135367 (Enable `unreachable_pub` lint in `alloc`)
 - rust-lang#135748 (Lower index bounds checking to `PtrMetadata`, this time with the right fake borrow semantics 😸)
 - rust-lang#135805 (Add missing allocator safety in alloc crate)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#135961 (Fix 2/4 tests skipped by opt-dist)
 - rust-lang#136012 (Document powf and powi values that are always 1.0)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c0005f1 into rust-lang:master Jan 28, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 28, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup merge of rust-lang#133151 - tyrone-wu:trim-fn-ptr-whitespace, r=compiler-errors

Trim extra whitespace in fn ptr suggestion span

Trim extra whitespace when suggesting removal of invalid qualifiers when parsing function pointer type.

Fixes: rust-lang#133083

---

I made a comment about the format of the diagnostic error message in rust-lang#133083 (comment). I think the `.label` may be a little redundant if the diagnostic only highlights the bad qualifier instead of the entire `TyKind::BareFn` span. If it makes sense, I can include it in this PR.
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 14, 2025
…n, r=jdonszelmann

Rework how the disallowed qualifier in function type diagnostics are generated

This pull request fixes two independent issues:
1. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), the diagnostic suggests removing the incorrect qualifier.  Fixes rust-lang#142268, which is an issue created by rust-lang#133151. This is fixed by moving the check into `parse_fn_front_matter`, where better span information is available to generate the right suggestions.
2. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), `cargo fix` crashes because "cannot replace slice of data that was already replaced". This is fixed by not generating a suggestion for the "wrong order" diagnostic if the "disallowed qualifier" diagnostic is triggered.

There is a commit with failing tests so the test diff is clearer
r? `@jdonszelmann`
rust-timer added a commit that referenced this pull request Jun 14, 2025
Rollup merge of #142302 - JonathanBrouwer:invalid-const-token, r=jdonszelmann

Rework how the disallowed qualifier in function type diagnostics are generated

This pull request fixes two independent issues:
1. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), the diagnostic suggests removing the incorrect qualifier.  Fixes #142268, which is an issue created by #133151. This is fixed by moving the check into `parse_fn_front_matter`, where better span information is available to generate the right suggestions.
2. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), `cargo fix` crashes because "cannot replace slice of data that was already replaced". This is fixed by not generating a suggestion for the "wrong order" diagnostic if the "disallowed qualifier" diagnostic is triggered.

There is a commit with failing tests so the test diff is clearer
r? `@jdonszelmann`
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
Development

Successfully merging this pull request may close these issues.

Extra whitespace when suggesting removal of invalid qualifiers from fn pointer
4 participants