Skip to content

Commit b3e6f8d

Browse files
committed
Update tests
1 parent 97116eb commit b3e6f8d

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

src/test/ui/async-await/async-fn-nonsend.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// edition:2018
33
// compile-flags: --crate-type lib
44

5+
#![feature(generator_mir_traits)]
6+
57
use std::{
68
cell::RefCell,
79
fmt::Debug,

src/test/ui/async-await/async-fn-nonsend.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
2-
--> $DIR/async-fn-nonsend.rs:50:5
2+
--> $DIR/async-fn-nonsend.rs:52:5
33
|
44
LL | fn assert_send(_: impl Send) {}
55
| ----------- ---- required by this bound in `assert_send`
@@ -11,8 +11,8 @@ LL | assert_send(non_send_temporary_in_match());
1111
= note: required because it appears within the type `impl std::fmt::Debug`
1212
= note: required because it appears within the type `std::option::Option<impl std::fmt::Debug>`
1313
= note: required because it appears within the type `[witness@DefId(0:25 ~ async_fn_nonsend[8787]::non_send_temporary_in_match[0]::{{closure}}[0]){impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]`
14-
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 [witness@DefId(0:25 ~ async_fn_nonsend[8787]::non_send_temporary_in_match[0]::{{closure}}[0]){impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]]`
15-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 [witness@DefId(0:25 ~ async_fn_nonsend[8787]::non_send_temporary_in_match[0]::{{closure}}[0]){impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]]>`
14+
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:30:40: 39:2 [witness@DefId(0:25 ~ async_fn_nonsend[8787]::non_send_temporary_in_match[0]::{{closure}}[0]){impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]]`
15+
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:30:40: 39:2 [witness@DefId(0:25 ~ async_fn_nonsend[8787]::non_send_temporary_in_match[0]::{{closure}}[0]){impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]]>`
1616
= note: required because it appears within the type `impl std::future::Future`
1717
= note: required because it appears within the type `impl std::future::Future`
1818

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// compile-fail
2+
// edition:2018
3+
4+
fn is_send<T: Send>(val: T) {}
5+
6+
async fn dummy() {}
7+
8+
async fn not_send() {
9+
let val: *const ();
10+
dummy().await;
11+
}
12+
13+
fn main() {
14+
is_send(not_send());
15+
//~^ ERROR `*const ()` cannot be sent between threads safely
16+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0277]: `*const ()` cannot be sent between threads safely
2+
--> $DIR/feature-gate-generator_mir_traits.rs:14:5
3+
|
4+
LL | fn is_send<T: Send>(val: T) {}
5+
| ------- ---- required by this bound in `is_send`
6+
...
7+
LL | is_send(not_send());
8+
| ^^^^^^^ `*const ()` cannot be sent between threads safely
9+
|
10+
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `*const ()`
11+
note: future does not implement `std::marker::Send` as this value is used across an await
12+
--> $DIR/feature-gate-generator_mir_traits.rs:10:5
13+
|
14+
LL | let val: *const ();
15+
| --- has type `*const ()`
16+
LL | dummy().await;
17+
| ^^^^^^^^^^^^^ await occurs here, with `val` maybe used later
18+
LL | }
19+
| - `val` is later dropped here
20+
21+
error: aborting due to previous error
22+
23+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)