File tree Expand file tree Collapse file tree 2 files changed +8
-31
lines changed Expand file tree Collapse file tree 2 files changed +8
-31
lines changed Original file line number Diff line number Diff line change 22// edition:2018
33// compile-flags: --crate-type lib
44
5- use std:: {
6- cell:: RefCell ,
7- fmt:: Debug ,
8- rc:: Rc ,
9- } ;
5+ use std:: { cell:: RefCell , fmt:: Debug , rc:: Rc } ;
106
11- fn non_sync ( ) -> impl Debug { RefCell :: new ( ( ) ) }
7+ fn non_sync ( ) -> impl Debug {
8+ RefCell :: new ( ( ) )
9+ }
1210
13- fn non_send ( ) -> impl Debug { Rc :: new ( ( ) ) }
11+ fn non_send ( ) -> impl Debug {
12+ Rc :: new ( ( ) )
13+ }
1414
1515fn take_ref < T > ( _: & T ) { }
1616
@@ -53,5 +53,4 @@ pub fn pass_assert() {
5353 //~^ ERROR future cannot be sent between threads safely
5454 assert_send ( non_sync_with_method_call ( ) ) ;
5555 //~^ ERROR future cannot be sent between threads safely
56- //~^^ ERROR future cannot be sent between threads safely
5756}
Original file line number Diff line number Diff line change @@ -62,27 +62,5 @@ LL | }
6262LL | }
6363 | - `f` is later dropped here
6464
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
8866
You can’t perform that action at this time.
0 commit comments