-
Notifications
You must be signed in to change notification settings - Fork 14.1k
[generator] Special cases for match guard when analyzing interior types in generators #75213
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
Changes from all commits
f9ccd39
7f5721c
323f079
66345d9
df127b8
4a8ba7b
50627a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // check-pass | ||
|
||
| // edition:2018 | ||
|
|
||
| // This test is derived from | ||
| // https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468 | ||
|
|
||
| // This test demonstrates that, in `async fn g()`, | ||
| // indeed a temporary borrow `y` from `x` is live | ||
| // while `f().await` is being evaluated. | ||
| // Thus, `&'_ u8` should be included in type signature | ||
| // of the underlying generator. | ||
|
|
||
| async fn f() -> u8 { 1 } | ||
|
|
||
| pub async fn g(x: u8) { | ||
| match x { | ||
| y if f().await == y => (), | ||
| _ => (), | ||
| } | ||
| } | ||
|
|
||
| fn main() { | ||
| let _ = g(10); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It may worth be restating what you said above in a comment here, i.e. that we need to record these regardless of where they appear in the post-order traversal.