-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[generator] Special cases for match guard when analyzing interior types in generators #75213
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This MVCE no longer ICEs for me, whereas this one does: #72651 (comment). No need to leave credit, just an issue number is enough. (Feel free to also include this one if you can confirm it did ICE at one point, though). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test case has been updated to refer to the said MVCE. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tmandry Forgot to mention this. This test case compiles if the async functions are not used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, in that case let's put both test cases in! |
||
// 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.