Rollup merge of #72260 - csmoe:issue-69276, r=estebank

Spell out `Self` in async function return

Closes #69276
r? @tmandry
This commit is contained in:
Dylan DPC 2020-06-05 13:07:03 +02:00 committed by GitHub
commit 14dc34dd89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 98 additions and 43 deletions

View file

@ -1,8 +1,9 @@
error: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
error[E0760]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
--> $DIR/issue-61949-self-return-type.rs:11:40
|
LL | pub async fn new(_bar: &'a i32) -> Self {
| ^^^^
| ^^^^ help: consider spelling out the type instead: `Foo<'a>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0760`.

View file

@ -21,7 +21,7 @@ help: consider constraining the associated type `<T as impl_trait::Trait>::Assoc
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^
error: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
error[E0760]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
--> $DIR/bound-normalization-fail.rs:43:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
@ -43,4 +43,5 @@ LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output=T::
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0271`.
Some errors have detailed explanations: E0271, E0760.
For more information about an error, try `rustc --explain E0271`.