Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Note closure captures when reporting cast to fn ptr failed #128082

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

compiler-errors
Copy link
Member

Fixes #128078

We already had logic to point out a closure having captures when that's possibly the source of a coercion error to fn(), but we weren't reporting it during an explicit as cast.

@rustbot
Copy link
Collaborator

rustbot commented Jul 23, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
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 Jul 23, 2024
@estebank
Copy link
Contributor

We should extend suggest_no_capture_closure to point at where the captured binding was defined, for completeness.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 23, 2024

📌 Commit b7495b4 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 Jul 23, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 23, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#125886 (Migrate run make issue 15460)
 - rust-lang#126898 (Migrate `run-make/link-framework` to `rmake.rs`)
 - rust-lang#126994 (Support lists and stylings in more places for `rustc --explain`)
 - rust-lang#127990 (Migrate `lto-linkage-used-attr`, `no-duplicate-libs` and `pgo-gen-no-imp-symbols` `run-make` tests to rmake)
 - rust-lang#128060 (Fix inclusion of `wasm-component-ld` in dist artifacts)
 - rust-lang#128082 (Note closure captures when reporting cast to fn ptr failed)
 - rust-lang#128098 (make it possible to disable download-rustc if it's incompatible)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c2ba4b1 into rust-lang:master Jul 23, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Jul 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 23, 2024
Rollup merge of rust-lang#128082 - compiler-errors:closure-cap, r=estebank

Note closure captures when reporting cast to fn ptr failed

Fixes rust-lang#128078

We already had logic to point out a closure having captures when that's possibly the source of a coercion error to `fn()`, but we weren't reporting it during an explicit `as` cast.
# for free to join this conversation on GitHub. Already have an account? # 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.

Invalid cast error when trying to cast a closure to a function pointer should mention captured variables
5 participants