File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ trait DynEq { }
2
+
3
+ impl < ' a > PartialEq for & ' a ( dyn DynEq + ' static ) {
4
+ fn eq ( & self , _other : & Self ) -> bool {
5
+ true
6
+ }
7
+ }
8
+
9
+ impl Eq for & dyn DynEq { } //~ ERROR E0308
10
+
11
+ fn main ( ) {
12
+ }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/E0308-2.rs:9:6
3
+ |
4
+ LL | impl Eq for &dyn DynEq {}
5
+ | ^^ lifetime mismatch
6
+ |
7
+ = note: expected trait `std::cmp::PartialEq`
8
+ found trait `std::cmp::PartialEq`
9
+ note: the lifetime `'_` as defined on the impl at 9:13...
10
+ --> $DIR/E0308-2.rs:9:13
11
+ |
12
+ LL | impl Eq for &dyn DynEq {}
13
+ | ^
14
+ = note: ...does not necessarily outlive the static lifetime
15
+
16
+ error: aborting due to previous error
17
+
18
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments