forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#63501 - nikomatsakis:issue-63500-async-anon…
…-impl-lifetime, r=cramertj use `ParamName` to track in-scope lifetimes instead of Ident Also, clear in-scope lifetimes when visiting nested items. Fixes rust-lang#63500. Fixes rust-lang#63225. Fixes rust-lang#52532. r? @cramertj
- Loading branch information
Showing
5 changed files
with
94 additions
and
9 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
17 changes: 17 additions & 0 deletions
17
src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs
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,17 @@ | ||
// Check that `async fn` inside of an impl with `'_` | ||
// in the header compiles correctly. | ||
// | ||
// Regression test for #63500. | ||
// | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
struct Foo<'a>(&'a u8); | ||
|
||
impl Foo<'_> { | ||
async fn bar() {} | ||
} | ||
|
||
fn main() { } |
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,17 @@ | ||
// Test that async fn works when nested inside of | ||
// impls with lifetime parameters. | ||
// | ||
// check-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
struct Foo<'a>(&'a ()); | ||
|
||
impl<'a> Foo<'a> { | ||
fn test() { | ||
async fn test() {} | ||
} | ||
} | ||
|
||
fn main() { } |
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,20 @@ | ||
// Test that the `'a` from the impl doesn't | ||
// prevent us from creating a `'a` parameter | ||
// on the `blah` function. | ||
// | ||
// check-pass | ||
|
||
#![feature(in_band_lifetimes)] | ||
|
||
struct Foo<'a> { | ||
x: &'a u32 | ||
|
||
} | ||
|
||
impl Foo<'a> { | ||
fn method(&self) { | ||
fn blah(f: Foo<'a>) { } | ||
} | ||
} | ||
|
||
fn main() { } |