]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/auxiliary/issue_89119_intercrate_caching.rs
Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
[rust.git] / tests / ui / traits / auxiliary / issue_89119_intercrate_caching.rs
1 // This is the auxiliary crate for the regression test for issue #89119, minimized
2 // from `zvariant-2.8.0`.
3
4 use std::convert::TryFrom;
5 use std::borrow::Cow;
6
7 pub struct Str<'a>(Cow<'a, str>);
8 impl<'a> Str<'a> {
9     pub fn to_owned(&self) -> Str<'static> {
10         todo!()
11     }
12 }
13
14 pub enum Value<'a> {
15     Str(Str<'a>),
16     Value(Box<Value<'a>>),
17 }
18 impl<'a> Value<'a> {
19     pub fn to_owned(&self) -> Value<'static> {
20         match self {
21             Value::Str(v) => Value::Str(v.to_owned()),
22             Value::Value(v) => {
23                 let o = OwnedValue::from(&**v);
24                 Value::Value(Box::new(o.into_inner()))
25             }
26         }
27     }
28 }
29
30 struct OwnedValue(Value<'static>);
31 impl OwnedValue {
32     pub(crate) fn into_inner(self) -> Value<'static> {
33         todo!()
34     }
35 }
36 impl<'a, T> TryFrom<OwnedValue> for Vec<T>
37 where
38     T: TryFrom<Value<'a>, Error = ()>,
39 {
40     type Error = ();
41     fn try_from(_: OwnedValue) -> Result<Self, Self::Error> {
42         todo!()
43     }
44 }
45 impl TryFrom<OwnedValue> for Vec<OwnedValue> {
46     type Error = ();
47     fn try_from(_: OwnedValue) -> Result<Self, Self::Error> {
48         todo!()
49     }
50 }
51 impl<'a> From<Value<'a>> for OwnedValue {
52     fn from(_: Value<'a>) -> Self {
53         todo!()
54     }
55 }
56 impl<'a> From<&Value<'a>> for OwnedValue {
57     fn from(_: &Value<'a>) -> Self {
58         todo!()
59     }
60 }