File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed
Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ pub trait FirstTrait {
4+ type Item;
5+ type Extra: Extra<(), Error = Self::Item>;
6+ }
7+
8+ trait SecondTrait {
9+ type Item2;
10+ }
11+
12+ trait ThirdTrait: SecondTrait {
13+ type Item3;
14+ }
15+
16+ trait FourthTrait {
17+ type Item4;
18+ }
19+
20+ impl<First> SecondTrait for First
21+ where
22+ First: FirstTrait,
23+ {
24+ type Item2 = First::Extra;
25+ }
26+
27+ impl<Second, T> ThirdTrait for Second
28+ where
29+ Second: SecondTrait<Item2 = T>,
30+ {
31+ type Item3 = T;
32+ }
33+
34+ impl<S, Third: ?Sized> FourthTrait for Third
35+ where
36+ Third: ThirdTrait<Item3 = S>,
37+ {
38+ type Item4 = S;
39+ }
40+
41+ pub trait Extra<Request> {
42+ type Error;
43+ }
44+
45+ struct ImplShoulExist<D, Req> {
46+ _gen: (D, Req),
47+ }
48+
49+ impl<D, Req> ImplShoulExist<D, Req>
50+ where
51+ D: FourthTrait,
52+ D::Item4: Extra<Req>,
53+ <D::Item4 as Extra<Req>>::Error: Into<()>,
54+ {
55+ fn access_fn(_: D) {
56+ todo!()
57+ }
58+ }
59+
60+ impl<D, Req> Extra<Req> for ImplShoulExist<D, Req> {
61+ type Error = ();
62+ }
63+
64+ pub fn broken<MS>(ms: MS)
65+ where
66+ MS: FirstTrait,
67+ MS::Item: Into<()>,
68+ {
69+ // Error: Apparently Balance::new doesn't exist during MIR validation
70+ let _ = ImplShoulExist::<MS, ()>::access_fn(ms);
71+ }
72+
73+ fn main() {}
You can’t perform that action at this time.
0 commit comments