File tree 2 files changed +8
-31
lines changed
2 files changed +8
-31
lines changed Original file line number Diff line number Diff line change 2
2
// edition:2018
3
3
// compile-flags: --crate-type lib
4
4
5
- use std:: {
6
- cell:: RefCell ,
7
- fmt:: Debug ,
8
- rc:: Rc ,
9
- } ;
5
+ use std:: { cell:: RefCell , fmt:: Debug , rc:: Rc } ;
10
6
11
- fn non_sync ( ) -> impl Debug { RefCell :: new ( ( ) ) }
7
+ fn non_sync ( ) -> impl Debug {
8
+ RefCell :: new ( ( ) )
9
+ }
12
10
13
- fn non_send ( ) -> impl Debug { Rc :: new ( ( ) ) }
11
+ fn non_send ( ) -> impl Debug {
12
+ Rc :: new ( ( ) )
13
+ }
14
14
15
15
fn take_ref < T > ( _: & T ) { }
16
16
@@ -53,5 +53,4 @@ pub fn pass_assert() {
53
53
//~^ ERROR future cannot be sent between threads safely
54
54
assert_send ( non_sync_with_method_call ( ) ) ;
55
55
//~^ ERROR future cannot be sent between threads safely
56
- //~^^ ERROR future cannot be sent between threads safely
57
56
}
Original file line number Diff line number Diff line change @@ -62,27 +62,5 @@ LL | }
62
62
LL | }
63
63
| - `f` is later dropped here
64
64
65
- error: future cannot be sent between threads safely
66
- --> $DIR/async-fn-nonsend.rs:54:5
67
- |
68
- LL | fn assert_send(_: impl Send) {}
69
- | ----------- ---- required by this bound in `assert_send`
70
- ...
71
- LL | assert_send(non_sync_with_method_call());
72
- | ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
73
- |
74
- = help: within `std::fmt::ArgumentV1<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)`
75
- note: future is not `Send` as this value is used across an await
76
- --> $DIR/async-fn-nonsend.rs:43:9
77
- |
78
- LL | let f: &mut std::fmt::Formatter = panic!();
79
- | - has type `&mut std::fmt::Formatter<'_>`
80
- LL | if non_sync().fmt(f).unwrap() == () {
81
- LL | fut().await;
82
- | ^^^^^^^^^^^ await occurs here, with `f` maybe used later
83
- LL | }
84
- LL | }
85
- | - `f` is later dropped here
86
-
87
- error: aborting due to 4 previous errors
65
+ error: aborting due to 3 previous errors
88
66
You can’t perform that action at this time.
0 commit comments