1 // Test that coherence detects overlap when some of the types in the
2 // impls are projections of associated type. Issue #20624.
4 use std::marker::PhantomData;
7 pub struct Cow<'a, B: ?Sized>(PhantomData<(&'a (),B)>);
9 /// Trait for moving into a `Cow`
10 pub trait IntoCow<'a, B: ?Sized> {
11 /// Moves `self` into `Cow`
12 fn into_cow(self) -> Cow<'a, B>;
15 impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
16 fn into_cow(self) -> Cow<'a, B> {
21 impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
23 fn into_cow(self) -> Cow<'a, B> {
28 impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
30 fn into_cow(self) -> Cow<'a, B> {
36 type Owned = &'static u8;
37 fn to_owned(&self) -> &'static u8 { panic!() }
40 /// A generalization of Clone to borrowed data.
44 /// Creates owned data from borrowed data, usually by copying.
45 fn to_owned(&self) -> Self::Owned;