mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Rollup merge of #132488 - compiler-errors:more-fixmes-bye, r=jieyouxu
Remove or fix some more `FIXME(async_closure)` Self-explanatory
This commit is contained in:
commit
30497b05cd
@ -432,7 +432,6 @@ where
|
|||||||
upvar.visit_with(self);
|
upvar.visit_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(async_closures): Is this the right signature to visit here?
|
|
||||||
args.as_coroutine_closure().signature_parts_ty().visit_with(self);
|
args.as_coroutine_closure().signature_parts_ty().visit_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
//@[v0] compile-flags: -Csymbol-mangling-version=v0
|
//@[v0] compile-flags: -Csymbol-mangling-version=v0
|
||||||
//@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options
|
//@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options
|
||||||
|
|
||||||
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
|
|
||||||
//@ ignore-pass (test emits codegen-time warnings)
|
|
||||||
|
|
||||||
#![feature(async_closure, noop_waker)]
|
#![feature(async_closure, noop_waker)]
|
||||||
|
|
||||||
extern crate block_on;
|
extern crate block_on;
|
||||||
|
@ -38,7 +38,10 @@ fn through_field_and_ref<'a>(x: &S<'a>) {
|
|||||||
|
|
||||||
let c = async move || { println!("{}", *x.0); };
|
let c = async move || { println!("{}", *x.0); };
|
||||||
outlives::<'a>(c());
|
outlives::<'a>(c());
|
||||||
// outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails
|
|
||||||
|
// outlives::<'a>(call_once(c));
|
||||||
|
// 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() {}
|
fn main() {}
|
||||||
|
@ -9,7 +9,7 @@ fn main() {
|
|||||||
|
|
||||||
let mut x = 1;
|
let mut x = 1;
|
||||||
needs_fn(async || {
|
needs_fn(async || {
|
||||||
//~^ ERROR async closure does not implement `FnMut` because it captures state from its environment
|
//~^ ERROR async closure does not implement `FnMut` because it captures state from its environment
|
||||||
x += 1;
|
x += 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ async fn async_main() {
|
|||||||
{
|
{
|
||||||
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
||||||
let c = guidance!(async move || {
|
let c = guidance!(async move || {
|
||||||
// s.a = 2; // FIXME(async_closures): Figure out why this fails
|
s.a = 2;
|
||||||
drop(s.b);
|
drop(s.b);
|
||||||
});
|
});
|
||||||
s.c.0 = "uncaptured";
|
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 mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") };
|
||||||
let c = guidance!(async move || {
|
let c = guidance!(async move || {
|
||||||
// s.a = 2; // FIXME(async_closures): Figure out why this fails
|
s.a = 2;
|
||||||
drop(s.b);
|
drop(s.b);
|
||||||
});
|
});
|
||||||
s.c.0 = "uncaptured";
|
s.c.0 = "uncaptured";
|
||||||
|
@ -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
|
let c = async || { println!("{}", *x.0); }; //~ ERROR `x` does not live long enough
|
||||||
outlives::<'a>(c());
|
outlives::<'a>(c());
|
||||||
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x`
|
outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
let c = async move || { println!("{}", *x.0); };
|
let c = async move || { println!("{}", *x.0); };
|
||||||
outlives::<'a>(c()); //~ ERROR `c` does not live long enough
|
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`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -100,7 +100,6 @@ LL | let c = async || { println!("{}", *x.0); };
|
|||||||
LL | outlives::<'a>(c());
|
LL | outlives::<'a>(c());
|
||||||
LL | outlives::<'a>(call_once(c));
|
LL | outlives::<'a>(call_once(c));
|
||||||
| ------------ argument requires that `x` is borrowed for `'a`
|
| ------------ argument requires that `x` is borrowed for `'a`
|
||||||
...
|
|
||||||
LL | }
|
LL | }
|
||||||
| - `x` dropped here while still borrowed
|
| - `x` dropped here while still borrowed
|
||||||
|
|
||||||
@ -114,11 +113,10 @@ LL | outlives::<'a>(call_once(c));
|
|||||||
| ^^^^^^^^^^^^ lifetime `'a` required
|
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||||
|
|
||||||
error[E0597]: `c` does not live long enough
|
error[E0597]: `c` does not live long enough
|
||||||
--> $DIR/without-precise-captures-we-are-powerless.rs:43:20
|
--> $DIR/without-precise-captures-we-are-powerless.rs:45:20
|
||||||
|
|
|
|
||||||
LL | fn through_field_and_ref<'a>(x: &S<'a>) {
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
| -- lifetime `'a` defined here
|
| -- lifetime `'a` defined here
|
||||||
...
|
|
||||||
LL | let c = async move || { println!("{}", *x.0); };
|
LL | let c = async move || { println!("{}", *x.0); };
|
||||||
| - binding `c` declared here
|
| - binding `c` declared here
|
||||||
LL | outlives::<'a>(c());
|
LL | outlives::<'a>(c());
|
||||||
@ -126,11 +124,20 @@ LL | outlives::<'a>(c());
|
|||||||
| |
|
| |
|
||||||
| borrowed value does not live long enough
|
| borrowed value does not live long enough
|
||||||
| argument requires that `c` is borrowed for `'a`
|
| argument requires that `c` is borrowed for `'a`
|
||||||
LL | // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails
|
LL | outlives::<'a>(call_once(c));
|
||||||
LL | }
|
LL | }
|
||||||
| - `c` dropped here while still borrowed
|
| - `c` dropped here while still borrowed
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error[E0621]: explicit lifetime required in the type of `x`
|
||||||
|
--> $DIR/without-precise-captures-we-are-powerless.rs:46:20
|
||||||
|
|
|
||||||
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
|
||||||
|
| ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
|
||||||
|
...
|
||||||
|
LL | outlives::<'a>(call_once(c));
|
||||||
|
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0505, E0597, E0621.
|
Some errors have detailed explanations: E0505, E0597, E0621.
|
||||||
For more information about an error, try `rustc --explain E0505`.
|
For more information about an error, try `rustc --explain E0505`.
|
||||||
|
Loading…
Reference in New Issue
Block a user