Open
Description
I tried this code:
trait T {}
impl T for <&'static i32 as core::ops::Deref>::Target {}
impl T for () {}
I expected to see this happen: successful compilation, since <&'static i32 as core::ops::Deref>::Target
is i32
(clearly not ()
)
Instead, this happened: compilation failed with
error[E0119]: conflicting implementations of trait `T` for type `<&'static i32 as Deref>::Target`
--> src/lib.rs:3:1
|
2 | impl T for <&'static i32 as core::ops::Deref>::Target {}
| --------------------------------------------- first implementation here
3 | impl T for () {}
| ^^^^^^^^^^^^^ conflicting implementation for `<&'static i32 as Deref>::Target`
It should be noted, that substituting <&'static i32 as Deref>::Target
for i32
removes the error, i.e. the following code compiles:
trait T {}
impl T for i32 {}
impl T for () {}
Meta
rustc --version --verbose
:
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
In my testing, all of the following reproduced this behavior:
- stable 1.87.0
- beta 1.88.0-beta.5 (2025-06-01)
- nightly 1.89.0-nightly (2025-06-11)
(no backtrace produced)