]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | // ignore-test: This now ICEs again. |
2 | ||
dfeec247 XL |
3 | // build-pass |
4 | ||
94222f64 | 5 | #![feature(type_alias_impl_trait)] |
dfeec247 XL |
6 | |
7 | use std::marker::PhantomData; | |
8 | ||
74b04a01 | 9 | /* copied Index and TryFrom for convenience (and simplicity) */ |
dfeec247 XL |
10 | trait MyIndex<T> { |
11 | type O; | |
12 | fn my_index(self) -> Self::O; | |
13 | } | |
14 | trait MyFrom<T>: Sized { | |
15 | type Error; | |
16 | fn my_from(value: T) -> Result<Self, Self::Error>; | |
17 | } | |
18 | ||
19 | /* MCVE starts here */ | |
20 | trait F {} | |
21 | impl F for () {} | |
22 | type DummyT<T> = impl F; | |
23 | fn _dummy_t<T>() -> DummyT<T> {} | |
24 | ||
25 | struct Phantom1<T>(PhantomData<T>); | |
26 | struct Phantom2<T>(PhantomData<T>); | |
27 | struct Scope<T>(Phantom2<DummyT<T>>); | |
28 | ||
29 | impl<T> Scope<T> { | |
30 | fn new() -> Self { | |
31 | unimplemented!() | |
32 | } | |
33 | } | |
34 | ||
35 | impl<T> MyFrom<Phantom2<T>> for Phantom1<T> { | |
36 | type Error = (); | |
37 | fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> { | |
38 | unimplemented!() | |
39 | } | |
40 | } | |
41 | ||
42 | impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> { | |
43 | type O = T; | |
44 | fn my_index(self) -> Self::O { | |
45 | MyFrom::my_from(self.0).ok().unwrap() | |
46 | } | |
47 | } | |
48 | ||
49 | fn main() { | |
50 | let _pos: Phantom1<DummyT<()>> = Scope::new().my_index(); | |
51 | } |