Skip to content

Fix traits implemented for function items #1969

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

Merged
merged 1 commit into from
Aug 19, 2025

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 19, 2025

This fixes the set of traits implemented for function items. Fn family traits are not implemented in some cases. This is roughly implemented in assemble_fn_pointer_candidates.

I did not include "has variadic", since that also requires unsafe and extern "C" and is thus covered by the other rules, AFAIK. Could also add that to CYA, though.

Fixes #1968

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 19, 2025
This fixes the set of traits implemented for function items. `Fn` family
traits are not implemented in some cases. This is roughly implemented in
[`assemble_fn_pointer_candidates`](https://github.com/rust-lang/rust/blob/8c32e313cccf7df531e2d49ffb8227bb92304aee/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L553-L585).

I did not include "has variadic", since that also requires unsafe and
extern "C" and is thus covered by the other rules, AFAIK. Could also add
that to CYA, though.

Fixes rust-lang#1968
@traviscross traviscross enabled auto-merge August 19, 2025 21:38
@traviscross traviscross added this pull request to the merge queue Aug 19, 2025
Merged via the queue into rust-lang:master with commit 46e5bc8 Aug 19, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not all function items implement Fn* traits
3 participants