Skip to content

Rollup of 5 pull requests #73018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
create error code E0754
  • Loading branch information
csmoe committed May 16, 2020
commit 008d90a66a30bc8ff498f8ad47dea315c1853a75
1 change: 1 addition & 0 deletions src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ E0750: include_str!("./error_codes/E0750.md"),
E0751: include_str!("./error_codes/E0751.md"),
E0752: include_str!("./error_codes/E0752.md"),
E0753: include_str!("./error_codes/E0753.md"),
E0754: include_str!("./error_codes/E0754.md"),
;
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard
Expand Down
29 changes: 29 additions & 0 deletions src/librustc_error_codes/error_codes/E0754.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
`async fn`/`impl trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope.

Erroneous code example:

```compile_fail,E0754,edition2018
struct S<'a>(&'a i32);

impl<'a> S<'a> {
async fn new(i: &'a i32) -> Self {
S(&22)
}
}
```

To fix this error we need to spell out `Self` to `S<'a>`:

```edition2018
struct S<'a>(&'a i32);

impl<'a> S<'a> {
async fn new(i: &'a i32) -> S<'a> {
S(&22)
}
}
```

This will be allowed at some point in the future, but the implementation is not yet complete. See the [issue-61949] for this limitation.

[issue-61949]: https://github.com/rust-lang/rust/issues/61949