Closed
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