-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clear in-scope lifetimes for nested items in HIR lowering
This was causing us to incorrectly think the lifetimes were already declared on the scope for the nested item, when in fact they are not inherited.
- Loading branch information
1 parent
a02a171
commit e4756e6
Showing
3 changed files
with
65 additions
and
4 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
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() { } |