--- /dev/null
+trait DynEq {}
+
+impl<'a> PartialEq for &'a (dyn DynEq + 'static) {
+ fn eq(&self, _other: &Self) -> bool {
+ true
+ }
+}
+
+impl Eq for &dyn DynEq {} //~ ERROR E0308
+
+fn main() {
+}
--- /dev/null
+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
+ |
+LL | impl Eq for &dyn DynEq {}
+ | ^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.