2 #![feature(impl_trait_projections)]
4 // This test checks that we emit the correct borrowck error when `Self` or a projection is used as
5 // a return type. See #61949 for context.
13 pub fn new(_bar: &'a i32) -> impl Into<Self> {
24 //~^ ERROR `bar` does not live long enough
36 impl<T> FooLike for Foo<T> {
46 fn make_assoc(self) -> Self::Assoc;
49 /// `T::Assoc` can't be normalized any further here.
50 fn foo<T: Trait>(x: T) -> impl FooLike<Output = T::Assoc> {
54 impl<'a> Trait for &'a () {
57 fn make_assoc(self) -> &'a () { &() }
64 //~^ ERROR `y` does not live long enough
70 // Same with lifetimes in the trait
78 fn make_assoc(self) -> Self::Assoc;
81 /// Missing bound constraining `Assoc`, `T::Assoc` can't be normalized further.
82 fn foo<'a, T: Trait<'a>>(x: T) -> impl FooLike<Output = T::Assoc> {
86 impl<'a> Trait<'a> for &'a () {
89 fn make_assoc(self) -> &'a () { &() }
96 //~^ ERROR `y` does not live long enough