Skip to content

Commit a804a45

Browse files
Fix UI test
fmt::Formatter is still not Send/Sync, but the UI test emitted two errors, for the dyn Write and the Void inside Formatter. As of this PR, the Void is now gone, but the dyn Write remains.
1 parent 9ae32c9 commit a804a45

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
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

1515
fn 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
}

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

+1-23
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,5 @@ LL | }
6262
LL | }
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

0 commit comments

Comments
 (0)