diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-06-05 13:07:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-05 13:07:03 +0200 |
| commit | 14dc34dd89604e68e33c38a237dbdeeaf50be33f (patch) | |
| tree | 6f1e09024a69e4edccd5d5e8af2d25086e410e76 /src/librustc_error_codes | |
| parent | 219380d840877de97b0e17674be7212ebc929d51 (diff) | |
| parent | 9be635306cdf06dde62e2c1ebaadcdc33f44f45c (diff) | |
| download | rust-14dc34dd89604e68e33c38a237dbdeeaf50be33f.tar.gz rust-14dc34dd89604e68e33c38a237dbdeeaf50be33f.zip | |
Rollup merge of #72260 - csmoe:issue-69276, r=estebank
Spell out `Self` in async function return Closes #69276 r? @tmandry
Diffstat (limited to 'src/librustc_error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 1 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0760.md | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 5865042859d..7abe75a375a 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -437,6 +437,7 @@ 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"), +E0760: include_str!("./error_codes/E0760.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard diff --git a/src/librustc_error_codes/error_codes/E0760.md b/src/librustc_error_codes/error_codes/E0760.md new file mode 100644 index 00000000000..e1dcfefebcd --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0760.md @@ -0,0 +1,32 @@ +`async fn`/`impl trait` return type cannot contain a projection +or `Self` that references lifetimes from a parent scope. + +Erroneous code example: + +```compile_fail,E0760,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 |
