Skip to content

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

@xmh0511

Description

@xmh0511

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

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions