]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / src / test / ui / error-codes / e0119 / auxiliary / issue-23563-a.rs
1 // Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672
2
3 pub trait LolTo<T> {
4     fn convert_to(&self) -> T;
5 }
6
7 pub trait LolInto<T>: Sized {
8     fn convert_into(self) -> T;
9 }
10
11 pub trait LolFrom<T> {
12     fn from(_: T) -> Self;
13 }
14
15 impl<'a, T: ?Sized, U> LolInto<U> for &'a T where T: LolTo<U> {
16     fn convert_into(self) -> U {
17         self.convert_to()
18     }
19 }
20
21 impl<T, U> LolFrom<T> for U where T: LolInto<U> {
22     fn from(t: T) -> U {
23         t.convert_into()
24     }
25 }