We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bae1e03 commit b75ed4fCopy full SHA for b75ed4f
src/test/ui/error-codes/E0308-2.rs
@@ -0,0 +1,12 @@
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
src/test/ui/error-codes/E0308-2.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/E0308-2.rs:9:6
+ |
+LL | impl Eq for &dyn DynEq {}
+ | ^^ lifetime mismatch
+ = note: expected trait `std::cmp::PartialEq`
+ found trait `std::cmp::PartialEq`
+note: the lifetime `'_` as defined on the impl at 9:13...
+ --> $DIR/E0308-2.rs:9:13
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`.
0 commit comments