Closed
Description
UPDATED ISSUE:
The original issue that was reported by @arielb1 has largely been resolved. However, there remain some traits that were added before the new rules were completed, and which do not conform. Those traits are currently distinguished with old_orphan_check
markers. The remaining work is to fix these traits:
-
BorrowFrom
-
BorrowFromMut
-
IntoCow
-
ToOwned
-
PartialEq
ORIGINAL ISSUE:
The current version of orphan checking does not prevent me from break coherence if impls from different crates are non-orphan because of different type parameters of the same type, for example:
base.rs:
pub trait Base { fn work(&self); }
foo.rs:
extern crate base;
pub struct Foo;
impl<T> base::Base for (Foo, T) {
fn work(&self) { println!("foo!"); }
}
bar.rs:
extern crate base;
pub struct Bar;
impl<T> base::Base for (T, Bar) {
fn work(&self) { println!("bar!"); }
}
foobar.rs:
extern crate foo;
extern crate bar;
extern crate base;
use base::Base;
fn main() { (foo::Foo, bar::Bar).work(); }
Which of course ICE-s with a trans ambiguity.