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

Better diagnostic for fn items in variadic functions #133538

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

dev-ardi
Copy link
Contributor

closes #69232

@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2024

r? @davidtwco

rustbot has assigned @davidtwco.
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

@dev-ardi dev-ardi changed the title 69232 better diag Better diagnostic for fn items in variadic functions Nov 27, 2024
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

This is not how you coerce a function item to a function pointer. Instead, you've suggested to turn something into a pointer-to-a-fn-item (i.e. a pointer to a ZST). You need to use as fn() to coerce a function item to a function pointer.

Please fix this, and also squash this into one commit.

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 27, 2024
@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 28, 2024
@dev-ardi
Copy link
Contributor Author

Now I use the spans as requested.
In the next PR I'll use the same approach for variadic_error
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 28, 2024
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 28, 2024

📌 Commit 1e4817c 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 Nov 28, 2024
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 29, 2024
…iler-errors

Better diagnostic for fn items in variadic functions

closes rust-lang#69232
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#131323 (Support `clobber_abi` in AVR inline assembly)
 - rust-lang#133092 (Always set the deployment target when building std)
 - rust-lang#133134 (Don't use a SyntheticProvider for literally every type)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)
 - rust-lang#133592 (Misc: better instructions for envrc, ignore `/build` instead of `build/`)
 - rust-lang#133608 (Revert rust-lang#133418 (Store coverage source regions as `Span`) due to regression rust-lang#133606)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 29, 2024
…iler-errors

Better diagnostic for fn items in variadic functions

closes rust-lang#69232
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133134 (Don't use a SyntheticProvider for literally every type)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 72cf40d into rust-lang:master Nov 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
Rollup merge of rust-lang#133538 - dev-ardi:69232-better-diag, r=compiler-errors

Better diagnostic for fn items in variadic functions

closes rust-lang#69232
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Nov 30, 2024
…to_variadic_function, r=compiler-errors

Simplify hir_typeck_pass_to_variadic_function

r? `@compiler-errors`
This reworks a bit how the diagnostic is generated so that it does the same as rust-lang#133538

The `help` is useless now so I removed it
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Nov 30, 2024
…to_variadic_function, r=compiler-errors

Simplify hir_typeck_pass_to_variadic_function

r? ``@compiler-errors``
This reworks a bit how the diagnostic is generated so that it does the same as rust-lang#133538

The `help` is useless now so I removed it
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 30, 2024
Rollup merge of rust-lang#133620 - dev-ardi:simplify-hir_typeck_pass_to_variadic_function, r=compiler-errors

Simplify hir_typeck_pass_to_variadic_function

r? ``@compiler-errors``
This reworks a bit how the diagnostic is generated so that it does the same as rust-lang#133538

The `help` is useless now so I removed it
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.

Printed function definition types can be confusing
6 participants