Skip to content

Conversation

@paldepind
Copy link
Contributor

This PR

  • Improves type inference for closures by giving them the type dyn Fn instead of dyn FnOnce. This means that closures can now be passed to places where the trait FnMut and Fn is used.
  • Makes the type mention for FnMut(..) -> .. and Fn(..) -> .. work.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jan 15, 2026
TypeAlias getOutputType() { result = this.(TraitItemNode).getAssocItem("Output") }
}

/** Any of the function traits `FnOnce`, `FnMut`, or `Fn`. */

Check warning

Code scanning / CodeQL

Class QLDoc style Warning

The QLDoc for a class should start with 'A', 'An', or 'The'.
fn mention_dyn_future<T>(f: &dyn Future<Output = T>) {}

fn mention_dyn_fn_once<F>(f: &dyn FnOnce() -> F) {}
fn mention_dyn_fn_once<F>(f: &dyn Fn() -> F) {}

Check notice

Code scanning / CodeQL

Unused variable Note

Variable 'f' is not used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant