rust-lang / rust-lang/rust

Incorrect syntax when suggesting the use of `Fn*` traits as supertraits

Open
#118,225 2 comments 0 reactions 1 assignee View on GitHub

@compiler-errors is already working on this.

Since Nov 24, 2023.

A-diagnostics D-incorrect T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code
`
Box<dyn Fn(Vec<AstValueExpr>)->AstValueExpr + Clone>
`
Current output
The diagnosis suggests writing this code:
only auto traits can be used as additional traits in a trait object
consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Fn<(Vec<AstValueExpr>, )>+ Clone {}`
Desired output
However, the use of `Fn*` series traits should be used as `Fn(Vec<AstValueExpr>)`, that is, the correct suggestion should be `trait NewTrait: Fn(Vec<AstValueExpr>)->AstValueExpr + Clone{}`
Rationale and extra context

740b75e08f494fe8171bd7b920361a47

Other cases

No response

Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.