-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamneeds-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.
Description
STR
Example from libcore:
#![crate_type = "lib"]
#![feature(associated_types)]
#![no_implicit_prelude]
trait Iterator {
type Item;
}
trait AdditiveIterator {
type Sum;
fn sum(self) -> Self::Sum;
}
impl<I> AdditiveIterator for I where I: Iterator<Item=u8> { //~error conflicting implementation
type Sum = u8;
fn sum(self) -> u8 { loop {} }
}
impl<I> AdditiveIterator for I where I: Iterator<Item=u16> { //~note conflicting implementation here
type Sum = u16;
fn sum(self) -> u16 { loop {} }
}
Version
No type can implement both Iterator<Item=u8>
and Iterator<Item=u16>
, therefore these blanket impls are non overlapping and should be accepted.
alexbool, randomPoison, jonysy, paholg, mbr and 142 morebenluelo and elekTom
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamneeds-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.