You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitCommon<U>{fncommon<'r,A>(&'rself,f: |&'rU,&'rU| -> A) -> A;}impl<'t,T>Common<T>for(T,&'tT){fncommon<'r,A>(&'rself,f: |&'rT,&'rT| -> A) -> A{f(self.n0_ref(),self.n1_ref().clone())}}impl<'t,T>Common<T>for(&'tT,T){fncommon<'r,A>(&'rself,f: |&'rT,&'rT| -> A) -> A{f(self.n0_ref().clone(),self.n1_ref())}}
With message:
testtrait.rs:11:1: 15:2 error: conflicting implementations for trait `Common`
testtrait.rs:11 impl<'t, T> Common<T> for (&'t T, T) {
testtrait.rs:12 fn common<'r, A>(&'r self, f: |&'r T, &'r T| -> A) -> A {
testtrait.rs:13 f(self.n0_ref().clone(), self.n1_ref())
testtrait.rs:14 }
testtrait.rs:15 }
testtrait.rs:5:1: 9:2 note: note conflicting implementation here
testtrait.rs:5 impl<'t, T> Common<T> for (T, &'t T) {
testtrait.rs:6 fn common<'r, A>(&'r self, f: |&'r T, &'r T| -> A) -> A {
testtrait.rs:7 f(self.n0_ref(), self.n1_ref().clone())
testtrait.rs:8 }
testtrait.rs:9 }
testtrait.rs:5:1: 9:2 error: conflicting implementations for trait `Common`
testtrait.rs:5 impl<'t, T> Common<T> for (T, &'t T) {
testtrait.rs:6 fn common<'r, A>(&'r self, f: |&'r T, &'r T| -> A) -> A {
testtrait.rs:7 f(self.n0_ref(), self.n1_ref().clone())
testtrait.rs:8 }
testtrait.rs:9 }
testtrait.rs:11:1: 15:2 note: note conflicting implementation here
testtrait.rs:11 impl<'t, T> Common<T> for (&'t T, T) {
testtrait.rs:12 fn common<'r, A>(&'r self, f: |&'r T, &'r T| -> A) -> A {
testtrait.rs:13 f(self.n0_ref().clone(), self.n1_ref())
testtrait.rs:14 }
testtrait.rs:15 }
error: aborting due to 2 previous errors
task 'rustc' failed at 'explicit failure', /var/tmp/portage-ondisk/portage/dev-lang/rust-9999/work/rust-9999/src/libsyntax/diagnostic.rs:74
task '<main>' failed at 'explicit failure', /var/tmp/portage-ondisk/portage/dev-lang/rust-9999/work/rust-9999/src/librustc/lib.rs:440
However the conflict occurs only when there is T and U such that T = &U and U =&T which means that T = &T - i.e. it is a thing borrowed infinitely many times. As such type is not possible the instances are not conflicting and therefore should be allowed.
The text was updated successfully, but these errors were encountered:
Rust fails for following code:
With message:
However the conflict occurs only when there is T and U such that T = &U and U =&T which means that T = &T - i.e. it is a thing borrowed infinitely many times. As such type is not possible the instances are not conflicting and therefore should be allowed.
The text was updated successfully, but these errors were encountered: