Closed
Description
Code
I tried this code:
trait T {
type Key<'a>: for<'b> PartialEq<Self::Key<'b>>
where
Self: 'a;
}
impl T for () {
type Key<'a> = (&'a str, u32);
}
It used to compile on 1.69, so I expected it to compile under 1.70, but it failed with the following error
error: implementation of `PartialEq` is not general enough
--> src/lib.rs:8:20
|
8 | type Key<'a> = (&'a str, u32);
| ^^^^^^^^^^^^^^ implementation of `PartialEq` is not general enough
|
= note: `(&'a str, u32)` must implement `PartialEq<(&'0 str, u32)>`, for any lifetime `'0`...
= note: ...but it actually implements `PartialEq`
The same happens for structs that contain a reference and derive PartialEq
.
Version it worked on
1.69
Version with regression
1.70
rustc --version --verbose
:
rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged