"Conflicting implementations" when there are two (distinct) concrete impls, but not one
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
trait Simple {}
trait Complex {}
impl<T: Simple> Complex for T {}
impl<T: Complex> Complex for Option<T> {}
// Not strictly necessary, just as an example.
impl Complex for u32 {}
// Comment out either of these for a successful compilation.
impl Simple for Option<u64> {}
impl Simple for Option<i64> {}
I expected this to compile without issue, as all traits are crate-local and there are in practice no overlapping implementations, and in fact it was working when I only had one impl Simple.
However, with both the compiler produces:
error[E0119]: conflicting implementations of trait `Complex` for type `Option<_>`
--> src/lib.rs:5:1
|
4 | impl<T: Simple> Complex for T {}
| ----------------------------- first implementation here
5 | impl<T: Complex> Complex for Option<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Option<_>`
It seems like either this should be forbidden when there is only one impl as well, or it should be allowed when there is more than one.
Meta
rustc --version --verbose:
rustc 1.92.0-nightly (975e6c8fe 2025-09-23)
binary: rustc
commit-hash: 975e6c8fec280816d24fbde6b8dfe19620f2efe6
commit-date: 2025-09-23
host: aarch64-apple-darwin
release: 1.92.0-nightly
LLVM version: 21.1.1
rustc 1.95.0-nightly (18d13b533 2026-02-09)
binary: rustc
commit-hash: 18d13b5332916ffca8eadb9106d54b5b434e9978
commit-date: 2026-02-09
host: aarch64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0
Also checked against 1.93 stable in the playground.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproducer in src/lib.rs and compile it against the reported stable and nightly versions to confirm the inconsistent coherence behavior. Trace the compiler's trait-implementation overlap checking, then establish whether the intended result is acceptance or rejection and add a regression test covering both concrete implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100