Closed
Description
Currently, the following fails to compile:
struct Foo<T>;
impl<'a, T> Foo<&'a T> {
fn foo(&self) {}
}
impl<'a, T> Foo<&'a mut T> {
fn foo(&self) {}
}
The error:
<anon>:7:5: 7:21 error: duplicate definition of value `foo`
<anon>:7 fn foo(&self) {}
^~~~~~~~~~~~~~~~
<anon>:4:5: 4:21 note: first definition of value `foo` here
<anon>:4 fn foo(&self) {}
^~~~~~~~~~~~~~~~
If you construct an analogous situation using two separate impls of a trait providing foo
, it works just fine, because there is no overlap. Inherent impl blocks could be similarly flexible.