- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
use std::rc::Rc; #[derive(PartialEq)] pub struct Function { callback: Rc<dyn Fn()>, }
Current output
error[E0369]: binary operation `==` cannot be applied to type `Rc<dyn Fn()>` --> src/lib.rs:5:5 | 3 | #[derive(PartialEq)] | --------- in this derive macro expansion 4 | pub struct Function { 5 | callback: Rc<dyn Fn()>, | ^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: use parentheses to call these | 5 | (callback: Rc<dyn Fn()>)(), | + +++
Desired output
error[E0369]: binary operation `==` cannot be applied to type `Rc<dyn Fn()>` --> src/lib.rs:5:5 | 3 | #[derive(PartialEq)] | --------- in this derive macro expansion 4 | pub struct Function { 5 | callback: Rc<dyn Fn()>, | ^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
Rationale and extra context
No response
Other cases
Rust Version
1.86.0-nightly (2025-01-23 99768c80a1c094a5cfc3)
Anything else?
@rustbot label D-incorrect D-invalid-suggestion
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.