Bless tests.
This commit is contained in:
parent
286502c9ed
commit
211d2ed07b
@ -12,30 +12,43 @@ LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await
|
||||
| ^^^^^ await occurs here, with `r` maybe used later
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:16:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
error[E0277]: `Rc<()>` cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:47:13
|
||||
|
|
||||
LL | async fn foo2(x: Option<bool>) {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
...
|
||||
LL | is_send(foo2(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
|
||||
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-await-let-else.rs:20:27
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/async-await-let-else.rs:24:29
|
||||
|
|
||||
LL | bar2(Rc::new(())).await
|
||||
| ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
|
||||
| |
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
LL | };
|
||||
| - `Rc::new(())` is later dropped here
|
||||
LL | async fn bar2<T>(_: T) -> ! {
|
||||
| _____________________________^
|
||||
LL | | panic!()
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: required because it captures the following types: `impl Future<Output = !>`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/async-await-let-else.rs:18:32
|
||||
|
|
||||
LL | async fn foo2(x: Option<bool>) {
|
||||
| ________________________________^
|
||||
LL | | let Some(_) = x else {
|
||||
LL | | bar2(Rc::new(())).await
|
||||
LL | | };
|
||||
LL | | }
|
||||
| |_^
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:16:15
|
||||
|
|
||||
@ -53,9 +66,8 @@ note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-await-let-else.rs:30:29
|
||||
|
|
||||
LL | (Rc::new(()), bar().await);
|
||||
| ----------- ^^^^^ - `Rc::new(())` is later dropped here
|
||||
| | |
|
||||
| | await occurs here, with `Rc::new(())` maybe used later
|
||||
| ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
|
||||
| |
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:16:15
|
||||
@ -77,9 +89,6 @@ LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await;
|
||||
| ^^^^^ await occurs here, with `r` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:16:15
|
||||
|
|
||||
@ -88,3 +97,4 @@ LL | fn is_send<T: Send>(_: T) {}
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -10,7 +10,7 @@ fn get_future() -> impl Future<Output = ()> {
|
||||
}
|
||||
|
||||
async fn foo() {
|
||||
let a; //~ ERROR type inside `async fn` body must be known in this context
|
||||
let a; //~ ERROR type annotations needed
|
||||
get_future().await;
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,18 @@ LL | fn get_future() -> impl Future<Output = ()> {
|
||||
= help: the trait `Future` is not implemented for `()`
|
||||
= note: () must be a future or must implement `IntoFuture` to be awaited
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/async-error-span.rs:13:9
|
||||
|
|
||||
LL | let a;
|
||||
| ^ cannot infer type
|
||||
| ^
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/async-error-span.rs:14:18
|
||||
help: consider giving `a` an explicit type
|
||||
|
|
||||
LL | get_future().await;
|
||||
| ^^^^^
|
||||
LL | let a: /* Type */;
|
||||
| ++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0698.
|
||||
Some errors have detailed explanations: E0277, E0282.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// edition:2018
|
||||
// compile-flags: --crate-type lib -Zdrop-tracking
|
||||
// compile-flags: --crate-type lib
|
||||
|
||||
use std::{cell::RefCell, fmt::Debug, rc::Rc};
|
||||
|
||||
|
@ -12,9 +12,6 @@ LL | match Some(non_send()) {
|
||||
| ---------------- has type `Option<impl Debug>` which is not `Send`
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^ await occurs here, with `Some(non_send())` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `Some(non_send())` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:64:24
|
||||
|
|
||||
@ -36,9 +33,6 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
|
||||
...
|
||||
LL | fut().await;
|
||||
| ^^^^^ await occurs here, with `get_formatter()` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `get_formatter()` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:64:24
|
||||
|
|
||||
|
@ -1,18 +1,17 @@
|
||||
error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
--> $DIR/async-is-unwindsafe.rs:12:19
|
||||
--> $DIR/async-is-unwindsafe.rs:12:5
|
||||
|
|
||||
LL | is_unwindsafe(async {
|
||||
| ___________________^
|
||||
| _____^^^^^^^^^^^^^_-
|
||||
| | |
|
||||
| | `&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
LL | |
|
||||
LL | | use std::ptr::null;
|
||||
LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker};
|
||||
... |
|
||||
LL | | drop(cx_ref);
|
||||
LL | | });
|
||||
| | ^
|
||||
| | |
|
||||
| |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
| within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
||||
| |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
||||
|
|
||||
= help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
|
||||
= note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
|
||||
@ -24,9 +23,6 @@ LL | let cx_ref = &mut cx;
|
||||
LL |
|
||||
LL | async {}.await; // this needs an inner await point
|
||||
| ^^^^^ await occurs here, with `cx_ref` maybe used later
|
||||
...
|
||||
LL | });
|
||||
| - `cx_ref` is later dropped here
|
||||
note: required by a bound in `is_unwindsafe`
|
||||
--> $DIR/async-is-unwindsafe.rs:3:26
|
||||
|
|
||||
|
@ -1,5 +1,4 @@
|
||||
// edition:2021
|
||||
// compile-flags: -Z drop-tracking
|
||||
// build-pass
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
@ -1,6 +1,5 @@
|
||||
// build-pass
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking=y
|
||||
|
||||
fn main() {
|
||||
let _ = foo();
|
||||
|
@ -1,5 +1,4 @@
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// build-pass
|
||||
|
||||
struct A;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// edition: 2021
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0559]: variant `Option<_>::None` has no field named `value`
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:7:12
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:6:12
|
||||
|
|
||||
LL | None { value: (), ..Default::default() }.await;
|
||||
| ^^^^^ `Option<_>::None` does not have this field
|
||||
@ -7,7 +7,7 @@ LL | None { value: (), ..Default::default() }.await;
|
||||
= note: all struct fields are already assigned
|
||||
|
||||
error[E0277]: `Option<_>` is not a future
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:7:46
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:6:46
|
||||
|
|
||||
LL | None { value: (), ..Default::default() }.await;
|
||||
| -^^^^^
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
@ -1,22 +1,20 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:43:17
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:42:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:21:39
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:20:39
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:38:19
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:37:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// build-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// incremental
|
||||
// edition: 2021
|
||||
|
||||
@ -99,8 +98,6 @@ fn main() {
|
||||
send(async {
|
||||
//~^ ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||
});
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5
|
||||
|
|
||||
LL | / send(async {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||
LL | | });
|
||||
| |______^ implementation of `FnOnce` is not general enough
|
||||
@ -14,13 +12,11 @@ LL | | });
|
||||
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5
|
||||
|
|
||||
LL | / send(async {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||
LL | | });
|
||||
| |______^ implementation of `FnOnce` is not general enough
|
||||
@ -28,35 +24,5 @@ LL | | });
|
||||
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
|
||||
|
|
||||
LL | / send(async {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||
LL | | });
|
||||
| |______^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
|
||||
|
|
||||
LL | / send(async {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||
LL | | });
|
||||
| |______^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone();
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/field-assign-nonsend.rs:37:19
|
||||
|
|
||||
|
@ -1,6 +1,6 @@
|
||||
// edition: 2021
|
||||
// build-fail
|
||||
//~^^ ERROR overflow evaluating the requirement `<A as Second>::{opaque#0} == _`
|
||||
//~^^ ERROR cycle detected when computing layout of
|
||||
|
||||
#![feature(async_fn_in_trait)]
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
error[E0275]: overflow evaluating the requirement `<A as Second>::{opaque#0} == _`
|
||||
error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
|
||||
|
|
||||
= note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`...
|
||||
= note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle
|
||||
= note: cycle used when computing layout of `<impl at $DIR/indirect-recursion-issue-112047.rs:31:1: 31:21>::second::{opaque#0}`
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
@ -13,6 +13,7 @@ fn is_sync<T: Sync>(t: T) { }
|
||||
async fn bar() {
|
||||
let x = Foo;
|
||||
baz().await;
|
||||
drop(x);
|
||||
}
|
||||
|
||||
async fn baz() { }
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: future cannot be shared between threads safely
|
||||
--> $DIR/issue-64130-1-sync.rs:21:13
|
||||
--> $DIR/issue-64130-1-sync.rs:22:13
|
||||
|
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Sync`
|
||||
@ -12,8 +12,6 @@ LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
LL | baz().await;
|
||||
| ^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
--> $DIR/issue-64130-1-sync.rs:11:15
|
||||
|
|
||||
|
@ -13,6 +13,7 @@ fn is_send<T: Send>(t: T) { }
|
||||
async fn bar() {
|
||||
let x = Foo;
|
||||
baz().await;
|
||||
drop(x);
|
||||
}
|
||||
|
||||
async fn baz() { }
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-2-send.rs:21:13
|
||||
--> $DIR/issue-64130-2-send.rs:22:13
|
||||
|
|
||||
LL | is_send(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Send`
|
||||
@ -12,8 +12,6 @@ LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-2-send.rs:11:15
|
||||
|
|
||||
|
@ -16,6 +16,7 @@ fn is_qux<T: Qux>(t: T) {}
|
||||
async fn bar() {
|
||||
let x = Foo;
|
||||
baz().await;
|
||||
drop(x);
|
||||
}
|
||||
|
||||
async fn baz() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
|
||||
--> $DIR/issue-64130-3-other.rs:24:12
|
||||
--> $DIR/issue-64130-3-other.rs:25:12
|
||||
|
|
||||
LL | async fn bar() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
@ -14,8 +14,6 @@ LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
LL | baz().await;
|
||||
| ^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
--> $DIR/issue-64130-3-other.rs:14:14
|
||||
|
|
||||
|
@ -1,6 +1,5 @@
|
||||
// edition:2018
|
||||
// check-pass
|
||||
// compile-flags: -Zdrop-tracking=yes
|
||||
|
||||
use std::any::Any;
|
||||
use std::future::Future;
|
||||
|
@ -12,8 +12,6 @@ LL | let g = x.lock().unwrap();
|
||||
| - has type `MutexGuard<'_, u32>` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^ await occurs here, with `g` maybe used later
|
||||
LL | }
|
||||
| - `g` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-non-send-future-diags.rs:9:15
|
||||
|
|
||||
|
@ -16,8 +16,9 @@ impl Future for AFuture{
|
||||
|
||||
async fn foo() {
|
||||
spawn(async { //~ ERROR future cannot be sent between threads safely
|
||||
let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
AFuture.await;
|
||||
let _a = a;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,17 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-67252-unnamed-future.rs:18:11
|
||||
--> $DIR/issue-67252-unnamed-future.rs:18:5
|
||||
|
|
||||
LL | spawn(async {
|
||||
| ___________^
|
||||
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
LL | | AFuture.await;
|
||||
LL | | });
|
||||
| |_____^ future created by async block is not `Send`
|
||||
LL | spawn(async {
|
||||
| ^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6}`, the trait `Send` is not implemented for `*mut ()`
|
||||
= help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22:6}`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-67252-unnamed-future.rs:20:17
|
||||
|
|
||||
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| -- has type `*mut ()` which is not `Send`
|
||||
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| - has type `*mut ()` which is not `Send`
|
||||
LL | AFuture.await;
|
||||
| ^^^^^ await occurs here, with `_a` maybe used later
|
||||
LL | });
|
||||
| - `_a` is later dropped here
|
||||
| ^^^^^ await occurs here, with `a` maybe used later
|
||||
note: required by a bound in `spawn`
|
||||
--> $DIR/issue-67252-unnamed-future.rs:6:13
|
||||
|
|
||||
|
@ -11,7 +11,7 @@ use std::{
|
||||
fn require_send(_: impl Send) {}
|
||||
|
||||
struct Ready<T>(Option<T>);
|
||||
impl<T> Future for Ready<T> {
|
||||
impl<T: Unpin> Future for Ready<T> {
|
||||
type Output = T;
|
||||
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
|
||||
Poll::Ready(self.0.take().unwrap())
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:34:18
|
||||
--> $DIR/issue-68112.rs:34:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^ future created by async block is not `Send`
|
||||
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -18,10 +18,10 @@ LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:43:18
|
||||
--> $DIR/issue-68112.rs:43:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^ future created by async block is not `Send`
|
||||
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -37,12 +37,10 @@ LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/issue-68112.rs:62:18
|
||||
--> $DIR/issue-68112.rs:62:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -60,7 +58,7 @@ note: required because it appears within the type `impl Future<Output = Arc<RefC
|
||||
|
|
||||
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>`
|
||||
= note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>`
|
||||
note: required because it's used within this `async` block
|
||||
--> $DIR/issue-68112.rs:57:20
|
||||
|
|
||||
|
@ -13,7 +13,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
|
||||
}
|
||||
|
||||
fn foo(x: NotSync) -> impl Future + Send {
|
||||
//~^ ERROR future cannot be sent between threads safely
|
||||
//~^ ERROR `*mut ()` cannot be shared between threads safely
|
||||
async move {
|
||||
baz(|| async {
|
||||
foo(x.clone());
|
||||
|
@ -1,21 +1,41 @@
|
||||
error: future cannot be sent between threads safely
|
||||
error[E0277]: `*mut ()` cannot be shared between threads safely
|
||||
--> $DIR/issue-70935-complex-spans.rs:15:23
|
||||
|
|
||||
LL | fn foo(x: NotSync) -> impl Future + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
| ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
|
||||
|
|
||||
= help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-70935-complex-spans.rs:20:12
|
||||
note: required because it appears within the type `PhantomData<*mut ()>`
|
||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||
note: required because it appears within the type `NotSync`
|
||||
--> $DIR/issue-70935-complex-spans.rs:9:8
|
||||
|
|
||||
LL | baz(|| async {
|
||||
| _____________-
|
||||
LL | struct NotSync(PhantomData<*mut ()>);
|
||||
| ^^^^^^^
|
||||
= note: required for `&NotSync` to implement `Send`
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/issue-70935-complex-spans.rs:18:13
|
||||
|
|
||||
LL | baz(|| async {
|
||||
| ^^
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/issue-70935-complex-spans.rs:12:67
|
||||
|
|
||||
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
|
||||
| ___________________________________________________________________^
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: required because it captures the following types: `impl Future<Output = ()>`
|
||||
note: required because it's used within this `async` block
|
||||
--> $DIR/issue-70935-complex-spans.rs:17:5
|
||||
|
|
||||
LL | / async move {
|
||||
LL | | baz(|| async {
|
||||
LL | | foo(x.clone());
|
||||
LL | | }).await;
|
||||
| | - ^^^^^- the value is later dropped here
|
||||
| | | |
|
||||
| |_________| await occurs here, with the value maybe used later
|
||||
| has type `{closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15}` which is not `Send`
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -12,9 +12,6 @@ LL | let mut guard = m.lock().unwrap();
|
||||
| --------- has type `MutexGuard<'_, i32>` which is not `Send`
|
||||
LL | (async { "right"; }).await;
|
||||
| ^^^^^ await occurs here, with `mut guard` maybe used later
|
||||
LL | *guard += 1;
|
||||
LL | }
|
||||
| - `mut guard` is later dropped here
|
||||
note: required by a bound in `fake_spawn`
|
||||
--> $DIR/issue-71137.rs:8:27
|
||||
|
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Regression test for #93197
|
||||
// check-pass
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(try_blocks)]
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// edition:2021
|
||||
// build-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
fn main() {
|
||||
let _ = async {
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
fn make_arc() -> Arc<Mutex<()>> { unimplemented!() }
|
||||
|
||||
pub async fn f(_: ()) {}
|
||||
|
||||
pub async fn run() {
|
||||
let x: Arc<Mutex<()>> = unimplemented!();
|
||||
let x: Arc<Mutex<()>> = make_arc();
|
||||
f(*x.lock().unwrap()).await;
|
||||
}
|
||||
|
@ -3,11 +3,6 @@
|
||||
async fn foo() {
|
||||
inner::<false>().await
|
||||
//~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied
|
||||
//~| ERROR: type inside `async fn` body must be known in this context
|
||||
//~| ERROR: type inside `async fn` body must be known in this context
|
||||
//~| ERROR: type inside `async fn` body must be known in this context
|
||||
//~| ERROR: type inside `async fn` body must be known in this context
|
||||
//~| ERROR: type inside `async fn` body must be known in this context
|
||||
}
|
||||
|
||||
async fn inner<T, const PING: bool>() {}
|
||||
|
@ -7,7 +7,7 @@ LL | inner::<false>().await
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: function defined here, with 2 generic parameters: `T`, `PING`
|
||||
--> $DIR/issue-107280.rs:13:10
|
||||
--> $DIR/issue-107280.rs:8:10
|
||||
|
|
||||
LL | async fn inner<T, const PING: bool>() {}
|
||||
| ^^^^^ - ----------------
|
||||
@ -16,67 +16,6 @@ help: add missing generic argument
|
||||
LL | inner::<false, PING>().await
|
||||
| ++++++
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/issue-107280.rs:4:5
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/issue-107280.rs:4:22
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^
|
||||
error: aborting due to previous error
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/issue-107280.rs:4:5
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/issue-107280.rs:4:22
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/issue-107280.rs:4:5
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/issue-107280.rs:4:22
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/issue-107280.rs:4:5
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/issue-107280.rs:4:22
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/issue-107280.rs:4:5
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/issue-107280.rs:4:22
|
||||
|
|
||||
LL | inner::<false>().await
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0698.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
For more information about this error, try `rustc --explain E0107`.
|
||||
|
@ -1,6 +1,5 @@
|
||||
// edition:2018
|
||||
// check-pass
|
||||
// compile-flags: -Zdrop-tracking=yes
|
||||
|
||||
struct Foo(*const u8);
|
||||
|
||||
|
@ -7,5 +7,5 @@ fn g(_: impl Send) {}
|
||||
|
||||
fn main() {
|
||||
g(issue_67893::run())
|
||||
//~^ ERROR future cannot be sent between threads safely
|
||||
//~^ ERROR `MutexGuard<'_, ()>` cannot be sent between threads safely
|
||||
}
|
||||
|
@ -1,18 +1,27 @@
|
||||
error: future cannot be sent between threads safely
|
||||
error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely
|
||||
--> $DIR/issue-67893.rs:9:7
|
||||
|
|
||||
LL | g(issue_67893::run())
|
||||
| ^^^^^^^^^^^^^^^^^^ future is not `Send`
|
||||
| - ^^^^^^^^^^^^^^^^^^ `MutexGuard<'_, ()>` cannot be sent between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
::: $DIR/auxiliary/issue_67893.rs:9:20
|
||||
|
|
||||
LL | pub async fn run() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/auxiliary/issue_67893.rs:9:27
|
||||
= note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/auxiliary/issue_67893.rs:9:20
|
||||
|
|
||||
LL | f(*x.lock().unwrap()).await;
|
||||
| ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here
|
||||
| | |
|
||||
| | await occurs here, with `x.lock().unwrap()` maybe used later
|
||||
| has type `MutexGuard<'_, ()>` which is not `Send`
|
||||
LL | pub async fn run() {
|
||||
| ____________________^
|
||||
LL | | let x: Arc<Mutex<()>> = make_arc();
|
||||
LL | | f(*x.lock().unwrap()).await;
|
||||
LL | | }
|
||||
| |_^
|
||||
note: required by a bound in `g`
|
||||
--> $DIR/issue-67893.rs:6:14
|
||||
|
|
||||
@ -21,3 +30,4 @@ LL | fn g(_: impl Send) {}
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -1,6 +1,5 @@
|
||||
// build-pass
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking=y
|
||||
|
||||
#![feature(generators)]
|
||||
|
||||
|
@ -11,7 +11,7 @@ LL | async fn foo() {
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
|
||||
= note: required because it appears within the type `(NotSend,)`
|
||||
= note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()`
|
||||
= note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/partial-drop-partial-reinit.rs:28:16
|
||||
|
|
||||
|
@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -16,11 +16,17 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -29,9 +35,16 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -16,11 +16,17 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -29,9 +35,16 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:15:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -16,11 +16,17 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `{async block@$DIR/issue-110963-early.rs:15:11: 20:6}: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:35:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:15:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
@ -29,9 +35,16 @@ LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: could not prove `{async block@$DIR/issue-110963-early.rs:15:11: 20:6}: Send`
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:35:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -2,23 +2,11 @@
|
||||
// Error message should pinpoint the type parameter T as needing to be bound
|
||||
// (rather than give a general error message)
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
async fn bar<T>() -> () {}
|
||||
|
||||
async fn foo() {
|
||||
bar().await;
|
||||
//~^ ERROR type inside `async fn` body must be known in this context
|
||||
//~| ERROR type inside `async fn` body must be known in this context
|
||||
//~| ERROR type inside `async fn` body must be known in this context
|
||||
//~| NOTE cannot infer type for type parameter `T`
|
||||
//~| NOTE cannot infer type for type parameter `T`
|
||||
//~| NOTE cannot infer type for type parameter `T`
|
||||
//~| NOTE the type is part of the `async fn` body because of this `await`
|
||||
//~| NOTE the type is part of the `async fn` body because of this `await`
|
||||
//~| NOTE the type is part of the `async fn` body because of this `await`
|
||||
//~| NOTE in this expansion of desugaring of `await`
|
||||
//~| NOTE in this expansion of desugaring of `await`
|
||||
//~| NOTE in this expansion of desugaring of `await`
|
||||
//~^ ERROR type annotations needed
|
||||
}
|
||||
fn main() {}
|
||||
|
@ -1,39 +1,14 @@
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
| ^^^ cannot infer type of the type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:10:11
|
||||
help: consider specifying the generic argument
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^
|
||||
LL | bar::<T>().await;
|
||||
| +++++
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:10:11
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^
|
||||
error: aborting due to previous error
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:10:11
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0698`.
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
|
@ -1,5 +1,4 @@
|
||||
// check-fail
|
||||
// known-bug: #99492
|
||||
// check-pass
|
||||
// edition: 2021
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
@ -1,27 +0,0 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/async-reference-generality.rs:23:5
|
||||
|
|
||||
LL | / async {
|
||||
LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
|
||||
LL | | async {}.await;
|
||||
LL | | }
|
||||
| |_____^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&()`
|
||||
found reference `&()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/async-reference-generality.rs:23:5
|
||||
|
|
||||
LL | / async {
|
||||
LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
|
||||
LL | | async {}.await;
|
||||
LL | | }
|
||||
| |_____^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&()`
|
||||
found reference `&()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,23 +0,0 @@
|
||||
// compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2021
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
trait Client {
|
||||
type Connecting<'a>: Future + Send
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
fn connect(&'_ self) -> Self::Connecting<'a>;
|
||||
//~^ ERROR use of undeclared lifetime name `'a`
|
||||
}
|
||||
|
||||
fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
|
||||
where
|
||||
C: Client + Send + Sync,
|
||||
{
|
||||
async move { c.connect().await }
|
||||
//~^ ERROR `C` does not live long enough
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,24 +0,0 @@
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/erase-error-in-mir-drop-tracking.rs:11:46
|
||||
|
|
||||
LL | fn connect(&'_ self) -> Self::Connecting<'a>;
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn connect<'a>(&'_ self) -> Self::Connecting<'a>;
|
||||
| ++++
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | trait Client<'a> {
|
||||
| ++++
|
||||
|
||||
error: `C` does not live long enough
|
||||
--> $DIR/erase-error-in-mir-drop-tracking.rs:19:5
|
||||
|
|
||||
LL | async move { c.connect().await }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0261`.
|
@ -1 +0,0 @@
|
||||
WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858
|
@ -1,16 +1,24 @@
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:9:33
|
||||
|
|
||||
LL | let _b = {
|
||||
| -- borrow later stored here
|
||||
LL | let a = 3;
|
||||
LL | Pin::new(&mut || yield &a).resume(())
|
||||
| -- ^ borrowed value does not live long enough
|
||||
| |
|
||||
| ----------^
|
||||
| | |
|
||||
| | borrowed value does not live long enough
|
||||
| value captured here by generator
|
||||
| a temporary with access to the borrow is created here ...
|
||||
LL |
|
||||
LL | };
|
||||
| - `a` dropped here while still borrowed
|
||||
| -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
|
||||
| |
|
||||
| `a` dropped here while still borrowed
|
||||
|
|
||||
= note: the temporary is part of an expression at the end of a block;
|
||||
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
|
||||
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
|
||||
|
|
||||
LL | let x = Pin::new(&mut || yield &a).resume(()); x
|
||||
| +++++++ +++
|
||||
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:16:20
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
--> $DIR/clone-impl.rs:42:16
|
||||
--> $DIR/clone-impl.rs:42:5
|
||||
|
|
||||
LL | let gen_clone_0 = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:40:14
|
||||
@ -19,13 +19,13 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
--> $DIR/clone-impl.rs:42:16
|
||||
--> $DIR/clone-impl.rs:42:5
|
||||
|
|
||||
LL | let gen_clone_0 = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: generator does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:38:9
|
||||
@ -34,9 +34,6 @@ LL | let v = vec!['a'];
|
||||
| - has type `Vec<char>` which does not implement `Copy`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `v` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `v` is later dropped here
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:72:18
|
||||
|
|
||||
@ -44,13 +41,13 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
--> $DIR/clone-impl.rs:58:16
|
||||
--> $DIR/clone-impl.rs:58:5
|
||||
|
|
||||
LL | let gen_clone_1 = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:56:14
|
||||
@ -64,13 +61,13 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
--> $DIR/clone-impl.rs:58:16
|
||||
--> $DIR/clone-impl.rs:58:5
|
||||
|
|
||||
LL | let gen_clone_1 = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: generator does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:52:9
|
||||
@ -80,9 +77,6 @@ LL | let v = vec!['a'];
|
||||
...
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `v` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `v` is later dropped here
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:72:18
|
||||
|
|
||||
@ -90,13 +84,13 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
--> $DIR/clone-impl.rs:66:16
|
||||
--> $DIR/clone-impl.rs:66:5
|
||||
|
|
||||
LL | let gen_non_clone = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
...
|
||||
LL | check_copy(&gen_non_clone);
|
||||
| ^^^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:64:14
|
||||
@ -115,13 +109,13 @@ LL | struct NonClone;
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
--> $DIR/clone-impl.rs:68:17
|
||||
--> $DIR/clone-impl.rs:68:5
|
||||
|
|
||||
LL | let gen_non_clone = move || {
|
||||
| ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
...
|
||||
LL | check_clone(&gen_non_clone);
|
||||
| ^^^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Clone`
|
||||
--> $DIR/clone-impl.rs:64:14
|
||||
|
@ -1,5 +1,4 @@
|
||||
// build-pass
|
||||
// compile-flags:-Zdrop-tracking
|
||||
|
||||
//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR
|
||||
#![feature(generators)]
|
||||
|
@ -1,5 +1,4 @@
|
||||
// build-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
// A test to ensure generators capture values that were conditionally dropped,
|
||||
// and also that values that are dropped along all paths to a yield do not get
|
||||
|
@ -1,5 +1,4 @@
|
||||
// run-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
// Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement
|
||||
// the fake_read callback on ExprUseVisitor which caused this case to break.
|
||||
|
@ -1,18 +0,0 @@
|
||||
// compile-flags: -Zdrop-tracking-mir --edition=2021
|
||||
|
||||
#![feature(generators)]
|
||||
|
||||
pub async fn async_bad_body() {
|
||||
match true {} //~ ERROR non-exhaustive patterns: type `bool` is non-empty
|
||||
}
|
||||
|
||||
pub fn generator_bad_body() {
|
||||
|| {
|
||||
// 'non-exhaustive pattern' only seems to be reported once, so this annotation doesn't work
|
||||
// keep the function around so we can make sure it doesn't ICE
|
||||
match true {}; // ERROR non-exhaustive patterns: type `bool` is non-empty
|
||||
yield ();
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,17 +0,0 @@
|
||||
error[E0004]: non-exhaustive patterns: type `bool` is non-empty
|
||||
--> $DIR/drop-tracking-error-body.rs:6:11
|
||||
|
|
||||
LL | match true {}
|
||||
| ^^^^
|
||||
|
|
||||
= note: the matched value is of type `bool`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
||||
|
|
||||
LL ~ match true {
|
||||
LL + _ => todo!(),
|
||||
LL ~ }
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0004`.
|
@ -1,4 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
#![feature(generators, negative_impls, rustc_attrs)]
|
||||
|
||||
macro_rules! type_combinations {
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:24:25
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -13,17 +13,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `derived_drop::Client`
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/drop-tracking-parent-expression.rs:22:22
|
||||
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `derived_drop::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -34,17 +32,17 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-tracking-parent-expression.rs:41:19
|
||||
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:24:25
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -55,17 +53,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `significant_drop::Client`
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/drop-tracking-parent-expression.rs:22:22
|
||||
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `significant_drop::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -76,17 +72,17 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-tracking-parent-expression.rs:41:19
|
||||
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:24:25
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -97,17 +93,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
|
||||
= help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/drop-tracking-parent-expression.rs:22:22
|
||||
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -118,7 +112,7 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-tracking-parent-expression.rs:41:19
|
||||
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
@ -1,6 +1,5 @@
|
||||
// build-pass
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(generators)]
|
||||
|
||||
|
@ -1,14 +1,8 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/drop-yield-twice.rs:7:17
|
||||
--> $DIR/drop-yield-twice.rs:7:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | | let guard = Foo(42);
|
||||
LL | | yield;
|
||||
LL | | drop(guard);
|
||||
LL | | yield;
|
||||
LL | | })
|
||||
| |_____^ generator is not `Send`
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
@ -18,9 +12,6 @@ LL | let guard = Foo(42);
|
||||
| ----- has type `Foo` which is not `Send`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `guard` maybe used later
|
||||
...
|
||||
LL | })
|
||||
| - `guard` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-yield-twice.rs:15:19
|
||||
|
|
||||
|
@ -1,5 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
use std::ops::Generator;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0061]: this method takes 1 argument but 0 arguments were supplied
|
||||
--> $DIR/issue-102645.rs:16:22
|
||||
--> $DIR/issue-102645.rs:14:22
|
||||
|
|
||||
LL | Pin::new(&mut b).resume();
|
||||
| ^^^^^^-- an argument of type `()` is missing
|
||||
|
@ -1,5 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking-mir
|
||||
|
||||
#![feature(generators)]
|
||||
#![feature(generator_clone)]
|
||||
#![feature(generator_trait)]
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0382]: borrow of moved value: `g`
|
||||
--> $DIR/issue-105084.rs:39:14
|
||||
--> $DIR/issue-105084.rs:37:14
|
||||
|
|
||||
LL | let mut g = || {
|
||||
| ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:16:17: 16:19}`, which does not implement the `Copy` trait
|
||||
| ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
|
||||
...
|
||||
LL | let mut h = copy(g);
|
||||
| - value moved here
|
||||
@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(());
|
||||
| ^^^^^^ value borrowed here after move
|
||||
|
|
||||
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
|
||||
--> $DIR/issue-105084.rs:11:21
|
||||
--> $DIR/issue-105084.rs:9:21
|
||||
|
|
||||
LL | fn copy<T: Copy>(x: T) -> T {
|
||||
| ---- ^ this parameter takes ownership of the value
|
||||
@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable
|
||||
LL | let mut h = copy(g.clone());
|
||||
| ++++++++
|
||||
|
||||
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:16:17: 16:19}`
|
||||
--> $DIR/issue-105084.rs:33:17
|
||||
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
|
||||
--> $DIR/issue-105084.rs:31:17
|
||||
|
|
||||
LL | let mut g = || {
|
||||
| -- within this `{generator@$DIR/issue-105084.rs:16:17: 16:19}`
|
||||
| -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
|
||||
...
|
||||
LL | let mut h = copy(g);
|
||||
| ^^^^ within `{generator@$DIR/issue-105084.rs:16:17: 16:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
| ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
|
|
||||
note: generator does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/issue-105084.rs:23:22
|
||||
--> $DIR/issue-105084.rs:21:22
|
||||
|
|
||||
LL | Box::new((5, yield));
|
||||
| -------------^^^^^--
|
||||
@ -40,7 +40,7 @@ LL | Box::new((5, yield));
|
||||
| | yield occurs here, with `Box::new((5, yield))` maybe used later
|
||||
| has type `Box<(i32, ())>` which does not implement `Copy`
|
||||
note: required by a bound in `copy`
|
||||
--> $DIR/issue-105084.rs:11:12
|
||||
--> $DIR/issue-105084.rs:9:12
|
||||
|
|
||||
LL | fn copy<T: Copy>(x: T) -> T {
|
||||
| ^^^^ required by this bound in `copy`
|
||||
|
@ -1,5 +1,4 @@
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking-mir=yes
|
||||
#![feature(generators)]
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0499]: cannot borrow `*x` as mutable more than once at a time
|
||||
--> $DIR/issue-110929-generator-conflict-error-ice.rs:9:9
|
||||
--> $DIR/issue-110929-generator-conflict-error-ice.rs:8:9
|
||||
|
|
||||
LL | let _c = || yield *&mut *x;
|
||||
| -- -- first borrow occurs due to use of `*x` in generator
|
||||
|
@ -1,5 +1,4 @@
|
||||
// build-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
#![feature(generators, negative_impls)]
|
||||
#![allow(dropping_references, dropping_copy_types)]
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
// check-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(negative_impls, generators)]
|
||||
|
||||
|
@ -8,7 +8,7 @@ use std::{
|
||||
};
|
||||
|
||||
pub struct Ready<T>(Option<T>);
|
||||
impl<T> Generator<()> for Ready<T> {
|
||||
impl<T: Unpin> Generator<()> for Ready<T> {
|
||||
type Return = T;
|
||||
type Yield = ();
|
||||
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
|
||||
@ -36,7 +36,7 @@ fn test1() {
|
||||
yield;
|
||||
//~^ NOTE yield occurs here
|
||||
//~| NOTE value is used across a yield
|
||||
}; //~ NOTE later dropped here
|
||||
};
|
||||
require_send(send_gen);
|
||||
//~^ ERROR generator cannot be sent between threads
|
||||
//~| NOTE not `Send`
|
||||
@ -65,7 +65,6 @@ fn test2() {
|
||||
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely
|
||||
//~| NOTE `RefCell<i32>` cannot be shared between threads safely
|
||||
//~| NOTE required for
|
||||
//~| NOTE required by a bound introduced by this call
|
||||
//~| NOTE captures the following types
|
||||
//~| NOTE use `std::sync::RwLock` instead
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:40:18
|
||||
--> $DIR/issue-68112.rs:40:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^ generator is not `Send`
|
||||
| ^^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -14,9 +14,6 @@ LL | let _non_send_gen = make_non_send_generator();
|
||||
LL |
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `_non_send_gen` is later dropped here
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/issue-68112.rs:22:25
|
||||
|
|
||||
@ -24,12 +21,10 @@ LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/issue-68112.rs:64:18
|
||||
--> $DIR/issue-68112.rs:64:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -49,7 +44,7 @@ note: required because it appears within the type `impl Generator<Return = Arc<R
|
||||
|
|
||||
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
|
||||
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/issue-68112.rs:60:20
|
||||
|
|
||||
|
@ -1,6 +1,5 @@
|
||||
// edition:2021
|
||||
// run-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
#![feature(generators)]
|
||||
#![feature(negative_impls)]
|
||||
|
||||
use std::cell::Cell;
|
||||
struct NotSend;
|
||||
struct NotSync;
|
||||
|
||||
impl !Send for NotSend {}
|
||||
impl !Sync for NotSync {}
|
||||
|
||||
fn main() {
|
||||
fn assert_sync<T: Sync>(_: T) {}
|
||||
@ -8,14 +13,15 @@ fn main() {
|
||||
|
||||
assert_sync(|| {
|
||||
//~^ ERROR: generator cannot be shared between threads safely
|
||||
let a = Cell::new(2);
|
||||
let a = NotSync;
|
||||
yield;
|
||||
drop(a);
|
||||
});
|
||||
|
||||
let a = Cell::new(2);
|
||||
assert_send(|| {
|
||||
//~^ ERROR: E0277
|
||||
drop(&a);
|
||||
//~^ ERROR: generator cannot be sent between threads safely
|
||||
let a = NotSend;
|
||||
yield;
|
||||
drop(a);
|
||||
});
|
||||
}
|
||||
|
@ -1,58 +1,42 @@
|
||||
error[E0277]: `Cell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/not-send-sync.rs:16:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _____-----------_^
|
||||
| | |
|
||||
| | required by a bound introduced by this call
|
||||
LL | |
|
||||
LL | | drop(&a);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
||||
= note: required for `&Cell<i32>` to implement `Send`
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/not-send-sync.rs:16:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/not-send-sync.rs:7:23
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: generator cannot be shared between threads safely
|
||||
--> $DIR/not-send-sync.rs:9:17
|
||||
--> $DIR/not-send-sync.rs:14:5
|
||||
|
|
||||
LL | assert_sync(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | let a = Cell::new(2);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ generator is not `Sync`
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Sync`
|
||||
|
|
||||
= help: within `{generator@$DIR/not-send-sync.rs:9:17: 9:19}`, the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
||||
= help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
|
||||
note: generator is not `Sync` as this value is used across a yield
|
||||
--> $DIR/not-send-sync.rs:12:9
|
||||
--> $DIR/not-send-sync.rs:17:9
|
||||
|
|
||||
LL | let a = Cell::new(2);
|
||||
| - has type `Cell<i32>` which is not `Sync`
|
||||
LL | let a = NotSync;
|
||||
| - has type `NotSync` which is not `Sync`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `a` maybe used later
|
||||
LL | });
|
||||
| - `a` is later dropped here
|
||||
note: required by a bound in `assert_sync`
|
||||
--> $DIR/not-send-sync.rs:6:23
|
||||
--> $DIR/not-send-sync.rs:11:23
|
||||
|
|
||||
LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_sync`
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/not-send-sync.rs:21:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/not-send-sync.rs:24:9
|
||||
|
|
||||
LL | let a = NotSend;
|
||||
| - has type `NotSend` which is not `Send`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `a` maybe used later
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/not-send-sync.rs:12:23
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -1,5 +1,3 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![feature(generators, negative_impls, rustc_attrs)]
|
||||
|
||||
macro_rules! type_combinations {
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:25:25
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -13,17 +13,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `derived_drop::Client`
|
||||
= help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/parent-expression.rs:23:22
|
||||
--> $DIR/parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `derived_drop::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -34,17 +32,17 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/parent-expression.rs:42:19
|
||||
--> $DIR/parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:25:25
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -55,17 +53,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `significant_drop::Client`
|
||||
= help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/parent-expression.rs:23:22
|
||||
--> $DIR/parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `significant_drop::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -76,17 +72,17 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/parent-expression.rs:42:19
|
||||
--> $DIR/parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:25:25
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^ generator is not `Send`
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -97,17 +93,15 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
|
|
||||
= help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
|
||||
= help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/parent-expression.rs:23:22
|
||||
--> $DIR/parent-expression.rs:21:22
|
||||
|
|
||||
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
|
||||
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
|
||||
...
|
||||
LL | _ => yield,
|
||||
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
|
||||
LL | };
|
||||
| - `$name::Client::default()` is later dropped here
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -118,7 +112,7 @@ LL | | };
|
||||
LL | | );
|
||||
| |_____- in this macro invocation
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/parent-expression.rs:42:19
|
||||
--> $DIR/parent-expression.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_thing: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
@ -1,5 +1,4 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
// check-pass
|
||||
#![feature(negative_impls, generators)]
|
||||
|
||||
struct Foo;
|
||||
@ -12,26 +11,19 @@ struct Bar {
|
||||
|
||||
fn main() {
|
||||
assert_send(|| {
|
||||
//~^ ERROR generator cannot be sent between threads safely
|
||||
// FIXME: it would be nice to make this work.
|
||||
let guard = Bar { foo: Foo, x: 42 };
|
||||
drop(guard.foo);
|
||||
yield;
|
||||
});
|
||||
|
||||
assert_send(|| {
|
||||
//~^ ERROR generator cannot be sent between threads safely
|
||||
// FIXME: it would be nice to make this work.
|
||||
let guard = Bar { foo: Foo, x: 42 };
|
||||
let mut guard = Bar { foo: Foo, x: 42 };
|
||||
drop(guard);
|
||||
guard.foo = Foo;
|
||||
guard.x = 23;
|
||||
guard = Bar { foo: Foo, x: 23 };
|
||||
yield;
|
||||
});
|
||||
|
||||
assert_send(|| {
|
||||
//~^ ERROR generator cannot be sent between threads safely
|
||||
// FIXME: it would be nice to make this work.
|
||||
let guard = Bar { foo: Foo, x: 42 };
|
||||
let Bar { foo, x } = guard;
|
||||
drop(foo);
|
||||
|
@ -1,92 +0,0 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/partial-drop.rs:14:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | // FIXME: it would be nice to make this work.
|
||||
LL | | let guard = Bar { foo: Foo, x: 42 };
|
||||
LL | | drop(guard.foo);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ generator is not `Send`
|
||||
|
|
||||
= help: within `{generator@$DIR/partial-drop.rs:14:17: 14:19}`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:19:9
|
||||
|
|
||||
LL | let guard = Bar { foo: Foo, x: 42 };
|
||||
| ----- has type `Bar` which is not `Send`
|
||||
LL | drop(guard.foo);
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `guard` maybe used later
|
||||
LL | });
|
||||
| - `guard` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/partial-drop.rs:42:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/partial-drop.rs:22:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | // FIXME: it would be nice to make this work.
|
||||
LL | | let guard = Bar { foo: Foo, x: 42 };
|
||||
... |
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ generator is not `Send`
|
||||
|
|
||||
= help: within `{generator@$DIR/partial-drop.rs:22:17: 22:19}`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:29:9
|
||||
|
|
||||
LL | let guard = Bar { foo: Foo, x: 42 };
|
||||
| ----- has type `Bar` which is not `Send`
|
||||
...
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `guard` maybe used later
|
||||
LL | });
|
||||
| - `guard` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/partial-drop.rs:42:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/partial-drop.rs:32:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | // FIXME: it would be nice to make this work.
|
||||
LL | | let guard = Bar { foo: Foo, x: 42 };
|
||||
... |
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ generator is not `Send`
|
||||
|
|
||||
= help: within `{generator@$DIR/partial-drop.rs:32:17: 32:19}`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:38:9
|
||||
|
|
||||
LL | let guard = Bar { foo: Foo, x: 42 };
|
||||
| ----- has type `Bar` which is not `Send`
|
||||
...
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `guard` maybe used later
|
||||
LL | });
|
||||
| - `guard` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/partial-drop.rs:42:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -12,7 +12,7 @@ use std::{
|
||||
};
|
||||
|
||||
pub struct Ready<T>(Option<T>);
|
||||
impl<T> Generator<()> for Ready<T> {
|
||||
impl<T: Unpin> Generator<()> for Ready<T> {
|
||||
type Return = T;
|
||||
type Yield = ();
|
||||
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/generator-print-verbose-1.rs:37:18
|
||||
--> $DIR/generator-print-verbose-1.rs:37:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^ generator is not `Send`
|
||||
| ^^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -13,8 +13,6 @@ LL | let _non_send_gen = make_non_send_generator();
|
||||
| ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
|
||||
LL | };
|
||||
| - `_non_send_gen` is later dropped here
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/generator-print-verbose-1.rs:26:25
|
||||
|
|
||||
@ -22,12 +20,10 @@ LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-1.rs:56:18
|
||||
--> $DIR/generator-print-verbose-1.rs:56:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -47,7 +43,7 @@ note: required because it appears within the type `Opaque(DefId(0:36 ~ generator
|
||||
|
|
||||
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()`
|
||||
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/generator-print-verbose-1.rs:52:20
|
||||
|
|
||||
|
@ -2,8 +2,13 @@
|
||||
|
||||
// Same as test/ui/generator/not-send-sync.rs
|
||||
#![feature(generators)]
|
||||
#![feature(negative_impls)]
|
||||
|
||||
use std::cell::Cell;
|
||||
struct NotSend;
|
||||
struct NotSync;
|
||||
|
||||
impl !Send for NotSend {}
|
||||
impl !Sync for NotSync {}
|
||||
|
||||
fn main() {
|
||||
fn assert_sync<T: Sync>(_: T) {}
|
||||
@ -11,14 +16,15 @@ fn main() {
|
||||
|
||||
assert_sync(|| {
|
||||
//~^ ERROR: generator cannot be shared between threads safely
|
||||
let a = Cell::new(2);
|
||||
let a = NotSync;
|
||||
yield;
|
||||
drop(a);
|
||||
});
|
||||
|
||||
let a = Cell::new(2);
|
||||
assert_send(|| {
|
||||
//~^ ERROR: E0277
|
||||
drop(&a);
|
||||
//~^ ERROR: generator cannot be sent between threads safely
|
||||
let a = NotSend;
|
||||
yield;
|
||||
drop(a);
|
||||
});
|
||||
}
|
||||
|
@ -1,58 +1,42 @@
|
||||
error[E0277]: `Cell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-2.rs:19:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _____-----------_^
|
||||
| | |
|
||||
| | required by a bound introduced by this call
|
||||
LL | |
|
||||
LL | | drop(&a);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
||||
= note: required for `&'?4 Cell<i32>` to implement `Send`
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/generator-print-verbose-2.rs:19:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/generator-print-verbose-2.rs:10:23
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: generator cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-2.rs:12:17
|
||||
--> $DIR/generator-print-verbose-2.rs:17:5
|
||||
|
|
||||
LL | assert_sync(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | let a = Cell::new(2);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^ generator is not `Sync`
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Sync`
|
||||
|
|
||||
= help: within `{main::{closure#0} upvar_tys=() {Cell<i32>, ()}}`, the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
||||
= help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`
|
||||
note: generator is not `Sync` as this value is used across a yield
|
||||
--> $DIR/generator-print-verbose-2.rs:15:9
|
||||
--> $DIR/generator-print-verbose-2.rs:20:9
|
||||
|
|
||||
LL | let a = Cell::new(2);
|
||||
| - has type `Cell<i32>` which is not `Sync`
|
||||
LL | let a = NotSync;
|
||||
| - has type `NotSync` which is not `Sync`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `a` maybe used later
|
||||
LL | });
|
||||
| - `a` is later dropped here
|
||||
note: required by a bound in `assert_sync`
|
||||
--> $DIR/generator-print-verbose-2.rs:9:23
|
||||
--> $DIR/generator-print-verbose-2.rs:14:23
|
||||
|
|
||||
LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_sync`
|
||||
|
||||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/generator-print-verbose-2.rs:24:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/generator-print-verbose-2.rs:27:9
|
||||
|
|
||||
LL | let a = NotSend;
|
||||
| - has type `NotSend` which is not `Send`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `a` maybe used later
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/generator-print-verbose-2.rs:15:23
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -4,9 +4,10 @@ error[E0499]: cannot borrow `thing` as mutable more than once at a time
|
||||
LL | gen.as_mut().resume(&mut thing);
|
||||
| ---------- first mutable borrow occurs here
|
||||
LL | gen.as_mut().resume(&mut thing);
|
||||
| ------ ^^^^^^^^^^ second mutable borrow occurs here
|
||||
| |
|
||||
| first borrow later used by call
|
||||
| ^^^^^^^^^^ second mutable borrow occurs here
|
||||
LL |
|
||||
LL | }
|
||||
| - first borrow might be used here, when `gen` is dropped and runs the destructor for generator
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,10 +5,5 @@ fn main() {
|
||||
let _ = async {
|
||||
let s = std::array::from_fn(|_| ()).await;
|
||||
//~^ ERROR `[(); _]` is not a future
|
||||
//~| ERROR type inside `async` block must be known in this context
|
||||
//~| ERROR type inside `async` block must be known in this context
|
||||
//~| ERROR type inside `async` block must be known in this context
|
||||
//~| ERROR type inside `async` block must be known in this context
|
||||
//~| ERROR type inside `async` block must be known in this context
|
||||
};
|
||||
}
|
||||
|
@ -12,67 +12,6 @@ LL | let s = std::array::from_fn(|_| ()).await;
|
||||
= note: [(); _] must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required for `[(); _]` to implement `IntoFuture`
|
||||
|
||||
error[E0698]: type inside `async` block must be known in this context
|
||||
--> $DIR/unresolved-ct-var.rs:6:17
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
||||
|
|
||||
note: the type is part of the `async` block because of this `await`
|
||||
--> $DIR/unresolved-ct-var.rs:6:45
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^
|
||||
error: aborting due to previous error
|
||||
|
||||
error[E0698]: type inside `async` block must be known in this context
|
||||
--> $DIR/unresolved-ct-var.rs:6:17
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
||||
|
|
||||
note: the type is part of the `async` block because of this `await`
|
||||
--> $DIR/unresolved-ct-var.rs:6:45
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async` block must be known in this context
|
||||
--> $DIR/unresolved-ct-var.rs:6:17
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
||||
|
|
||||
note: the type is part of the `async` block because of this `await`
|
||||
--> $DIR/unresolved-ct-var.rs:6:45
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async` block must be known in this context
|
||||
--> $DIR/unresolved-ct-var.rs:6:17
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
||||
|
|
||||
note: the type is part of the `async` block because of this `await`
|
||||
--> $DIR/unresolved-ct-var.rs:6:45
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^
|
||||
|
||||
error[E0698]: type inside `async` block must be known in this context
|
||||
--> $DIR/unresolved-ct-var.rs:6:17
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
||||
|
|
||||
note: the type is part of the `async` block because of this `await`
|
||||
--> $DIR/unresolved-ct-var.rs:6:45
|
||||
|
|
||||
LL | let s = std::array::from_fn(|_| ()).await;
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0698.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -5,17 +5,6 @@
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
fn across() -> impl Generator {
|
||||
move || {
|
||||
let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
||||
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
|
||||
|
||||
yield;
|
||||
|
||||
for elem in b.iter() {}
|
||||
}
|
||||
}
|
||||
|
||||
fn capture() -> impl Generator {
|
||||
let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
||||
move || {
|
||||
@ -29,6 +18,5 @@ fn capture() -> impl Generator {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
across();
|
||||
capture();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/unsized-across-yield.rs:3:12
|
||||
--> $DIR/unsized-capture-across-yield.rs:3:12
|
||||
|
|
||||
LL | #![feature(unsized_locals)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -8,16 +8,7 @@ LL | #![feature(unsized_locals)]
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/unsized-across-yield.rs:10:13
|
||||
|
|
||||
LL | let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: all values live across `yield` must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/unsized-across-yield.rs:22:27
|
||||
--> $DIR/unsized-capture-across-yield.rs:11:27
|
||||
|
|
||||
LL | move || {
|
||||
| -- this closure captures all values by move
|
||||
@ -27,6 +18,6 @@ LL | println!("{:?}", &b);
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: all values captured by value by a closure must have a statically known size
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
21
tests/ui/generator/unsized-local-across-yield.rs
Normal file
21
tests/ui/generator/unsized-local-across-yield.rs
Normal file
@ -0,0 +1,21 @@
|
||||
#![feature(generator_trait)]
|
||||
#![feature(generators)]
|
||||
#![feature(unsized_locals)]
|
||||
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
fn across() -> impl Generator {
|
||||
move || {
|
||||
let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
||||
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
|
||||
|
||||
yield;
|
||||
|
||||
for elem in b.iter() {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
across();
|
||||
}
|
21
tests/ui/generator/unsized-local-across-yield.stderr
Normal file
21
tests/ui/generator/unsized-local-across-yield.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/unsized-local-across-yield.rs:3:12
|
||||
|
|
||||
LL | #![feature(unsized_locals)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/unsized-local-across-yield.rs:10:13
|
||||
|
|
||||
LL | let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: all values live across `yield` must have a statically known size
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -7,16 +7,6 @@ LL | | async {}.await; // a yield point
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: the lifetime defined here...
|
||||
--> $DIR/issue-100013.rs:16:38
|
||||
|
|
||||
LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
|
||||
| ^^
|
||||
note: ...must outlive the lifetime defined here
|
||||
--> $DIR/issue-100013.rs:16:34
|
||||
|
|
||||
LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
|
||||
| ^^
|
||||
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||
|
||||
error: lifetime bound not satisfied
|
||||
@ -28,16 +18,6 @@ LL | | async {}.await; // a yield point
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: the lifetime `'b` defined here...
|
||||
--> $DIR/issue-100013.rs:21:14
|
||||
|
|
||||
LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
|
||||
| ^^
|
||||
note: ...must outlive the lifetime `'a` defined here
|
||||
--> $DIR/issue-100013.rs:21:10
|
||||
|
|
||||
LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
|
||||
| ^^
|
||||
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||
|
||||
error: lifetime may not live long enough
|
||||
@ -62,16 +42,6 @@ LL | | async {}.await; // a yield point
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: the lifetime `'b` defined here...
|
||||
--> $DIR/issue-100013.rs:28:18
|
||||
|
|
||||
LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
|
||||
| ^^
|
||||
note: ...must outlive the lifetime `'a` defined here
|
||||
--> $DIR/issue-100013.rs:28:10
|
||||
|
|
||||
LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
|
||||
| ^^
|
||||
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -13,6 +13,7 @@ impl<S> Bar for S {
|
||||
fn foo<T>() -> Self::E {
|
||||
async {}
|
||||
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
//~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,11 @@ error: type parameter `T` is part of concrete type but not used in parameter lis
|
||||
LL | async {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-55872-2.rs:14:9
|
||||
|
|
||||
LL | async {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,7 +7,6 @@ fn foo() -> impl Generator<Yield = (), Return = ()> {
|
||||
//~| NOTE recursive opaque type
|
||||
//~| NOTE in this expansion of desugaring of
|
||||
|| {
|
||||
//~^ NOTE returning here
|
||||
let mut gen = Box::pin(foo());
|
||||
//~^ NOTE generator captures itself here
|
||||
let mut r = gen.as_mut().resume(());
|
||||
|
@ -1,18 +1,11 @@
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-generator.rs:5:13
|
||||
|
|
||||
LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
|
||||
LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
|
||||
...
|
||||
LL | / || {
|
||||
LL | |
|
||||
LL | | let mut gen = Box::pin(foo());
|
||||
| | ------- generator captures itself here
|
||||
LL | |
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____- returning here with type `{generator@$DIR/recursive-generator.rs:9:5: 9:7}`
|
||||
LL | let mut gen = Box::pin(foo());
|
||||
| ------- generator captures itself here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -112,16 +112,11 @@ LL | (substs_change::<&T>(),)
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
||||
|
|
||||
LL | fn generator_hold() -> impl Sized {
|
||||
| ^^^^^^^^^^ recursive opaque type
|
||||
LL |
|
||||
LL | / move || {
|
||||
LL | | let x = generator_hold();
|
||||
| | - generator captures itself here
|
||||
LL | | yield;
|
||||
LL | | x;
|
||||
LL | | }
|
||||
| |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 74:12}`
|
||||
LL | fn generator_hold() -> impl Sized {
|
||||
| ^^^^^^^^^^ recursive opaque type
|
||||
...
|
||||
LL | let x = generator_hold();
|
||||
| - generator captures itself here
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:86:26
|
||||
|
@ -13,7 +13,10 @@ async fn wheeee<T>(t: T) {
|
||||
}
|
||||
|
||||
async fn yes() {
|
||||
wheeee(&No {}).await; //~ ERROR `No` held across
|
||||
let no = No {};
|
||||
//~^ ERROR `No` held across
|
||||
wheeee(&no).await;
|
||||
drop(no);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user