File tree 3 files changed +61
-0
lines changed
3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ // run-rustfix
2
+ // https://github.com/rust-lang/rust/issues/79076
3
+
4
+ use std::cmp::PartialEq;
5
+
6
+ #[derive(Clone, Eq)] //~ ERROR [E0277]
7
+ pub struct Struct<T: std::clone::Clone>(T);
8
+
9
+ impl<T: Clone, U> PartialEq<U> for Struct<T>
10
+ where
11
+ U: Into<Struct<T>> + Clone
12
+ {
13
+ fn eq(&self, _other: &U) -> bool {
14
+ todo!()
15
+ }
16
+ }
17
+
18
+ fn main() {}
Original file line number Diff line number Diff line change
1
+ // run-rustfix
2
+ // https://github.com/rust-lang/rust/issues/79076
3
+
4
+ use std:: cmp:: PartialEq ;
5
+
6
+ #[ derive( Clone , Eq ) ] //~ ERROR [E0277]
7
+ pub struct Struct < T > ( T ) ;
8
+
9
+ impl < T : Clone , U > PartialEq < U > for Struct < T >
10
+ where
11
+ U : Into < Struct < T > > + Clone
12
+ {
13
+ fn eq ( & self , _other : & U ) -> bool {
14
+ todo ! ( )
15
+ }
16
+ }
17
+
18
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0277]: the trait bound `T: Clone` is not satisfied
2
+ --> $DIR/derive-clone-for-eq.rs:6:17
3
+ |
4
+ LL | #[derive(Clone, Eq)]
5
+ | ^^ the trait `Clone` is not implemented for `T`
6
+ |
7
+ note: required because of the requirements on the impl of `PartialEq` for `Struct<T>`
8
+ --> $DIR/derive-clone-for-eq.rs:9:19
9
+ |
10
+ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
11
+ | ^^^^^^^^^^^^ ^^^^^^^^^
12
+ note: required by a bound in `Eq`
13
+ --> $SRC_DIR/core/src/cmp.rs:LL:COL
14
+ |
15
+ LL | pub trait Eq: PartialEq<Self> {
16
+ | ^^^^^^^^^^^^^^^ required by this bound in `Eq`
17
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
18
+ help: consider restricting type parameter `T`
19
+ |
20
+ LL | pub struct Struct<T: std::clone::Clone>(T);
21
+ | +++++++++++++++++++
22
+
23
+ error: aborting due to previous error
24
+
25
+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments