-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove or fix some more FIXME(async_closure)
#132488
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
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 |
---|---|---|
|
@@ -5,9 +5,6 @@ | |
//@[v0] compile-flags: -Csymbol-mangling-version=v0 | ||
//@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options | ||
|
||
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this. | ||
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 was fixed. |
||
//@ ignore-pass (test emits codegen-time warnings) | ||
|
||
#![feature(async_closure, noop_waker)] | ||
|
||
extern crate block_on; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,10 @@ fn through_field_and_ref<'a>(x: &S<'a>) { | |
|
||
let c = async move || { println!("{}", *x.0); }; | ||
outlives::<'a>(c()); | ||
// outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails | ||
|
||
// outlives::<'a>(call_once(c)); | ||
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. Explanation for why this fails, since I understand it now, and it's totally expected. |
||
// The above fails b/c the by-move coroutine of `c` captures `x` in its entirety. | ||
// Since we have not asserted that the borrow for `&S<'a>` outlives `'a`, it'll fail. | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ async fn async_main() { | |
{ | ||
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") }; | ||
let c = guidance!(async move || { | ||
// s.a = 2; // FIXME(async_closures): Figure out why this fails | ||
s.a = 2; | ||
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 was fixed! |
||
drop(s.b); | ||
}); | ||
s.c.0 = "uncaptured"; | ||
|
@@ -141,7 +141,7 @@ async fn async_main() { | |
{ | ||
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") }; | ||
let c = guidance!(async move || { | ||
// s.a = 2; // FIXME(async_closures): Figure out why this fails | ||
s.a = 2; | ||
drop(s.b); | ||
}); | ||
s.c.0 = "uncaptured"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,10 +38,12 @@ fn through_field_and_ref<'a>(x: &S<'a>) { | |
let c = async || { println!("{}", *x.0); }; //~ ERROR `x` does not live long enough | ||
outlives::<'a>(c()); | ||
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x` | ||
} | ||
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. Split into two functions since one error actually just suppresses the other (due to NLL error deduplication, I believe). |
||
|
||
fn through_field_and_ref_move<'a>(x: &S<'a>) { | ||
let c = async move || { println!("{}", *x.0); }; | ||
outlives::<'a>(c()); //~ ERROR `c` does not live long enough | ||
// outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails | ||
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x` | ||
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 is expected to fail for the same reason as I elaborated above in |
||
} | ||
|
||
fn main() {} |
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.
it gets the job done.