forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#73025 - Dylan-DPC:rollup-a1uzj5u, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - rust-lang#72260 (Spell out `Self` in async function return) - rust-lang#72996 (Remove unsused `NodeId` related APIs in hir map) - rust-lang#73010 (Update RELEASES.md) - rust-lang#73017 (Use assert_eq for liballoc test) - rust-lang#73019 (add test for rust-lang#72960) Failed merges: r? @ghost
- Loading branch information
Showing
11 changed files
with
111 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// compile-flags: -Zsave-analysis | ||
// only-x86_64 | ||
// Also test for #72960 | ||
|
||
#![feature(asm)] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters