]>
Commit | Line | Data |
---|---|---|
60c5eb7d | 1 | // check-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
85aaf69f SL |
3 | // Regression test for #21726: an issue arose around the rules for |
4 | // subtyping of projection types that resulted in an unconstrained | |
5 | // region, yielding region inference failures. | |
6 | ||
c34b1796 AL |
7 | // pretty-expanded FIXME #23616 |
8 | ||
85aaf69f SL |
9 | fn main() { } |
10 | ||
11 | fn foo<'a>(s: &'a str) { | |
12 | let b: B<()> = B::new(s, ()); | |
13 | b.get_short(); | |
14 | } | |
15 | ||
16 | trait IntoRef<'a> { | |
17 | type T: Clone; | |
041b39d2 | 18 | fn into_ref(self, _: &'a str) -> Self::T; |
85aaf69f SL |
19 | } |
20 | ||
21 | impl<'a> IntoRef<'a> for () { | |
22 | type T = &'a str; | |
23 | fn into_ref(self, s: &'a str) -> &'a str { | |
24 | s | |
25 | } | |
26 | } | |
27 | ||
28 | struct B<'a, P: IntoRef<'a>>(P::T); | |
29 | ||
30 | impl<'a, P: IntoRef<'a>> B<'a, P> { | |
31 | fn new(s: &'a str, i: P) -> B<'a, P> { | |
32 | B(i.into_ref(s)) | |
33 | } | |
34 | ||
35 | fn get_short(&self) -> P::T { | |
36 | self.0.clone() | |
37 | } | |
38 | } |