2 // known-bug: #87735, #88526
4 // This should pass, but we need an extension of implied bounds (probably).
7 type Output<'a> where Self: 'a;
9 fn as_ref2<'a>(&'a self) -> Self::Output<'a>;
12 impl<T> AsRef2 for Vec<T> {
13 type Output<'a> = &'a [T] where Self: 'a;
15 fn as_ref2<'a>(&'a self) -> Self::Output<'a> {
23 struct FooRef<'a, U>(&'a [U]);
25 impl<'b, T, U> AsRef2 for Foo<T>
27 // * `for<'b, 'c> T: AsRef2<Output<'b> = &'c [U]>>` does not work
29 // * `U` is unconstrained but should be allowed in this context because `Output` is
31 T: AsRef2<Output<'b> = &'b [U]>,
34 type Output<'a> = FooRef<'a, U> where Self: 'a;
36 fn as_ref2<'a>(&'a self) -> Self::Output<'a> {
37 FooRef(self.0.as_ref2())
42 let foo = Foo(vec![1, 2, 3]);