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.
This commit is contained in:
Mark Rousskov 2020-01-20 12:17:12 -05:00
parent 9ae32c9b27
commit a804a45528
2 changed files with 8 additions and 31 deletions

View File

@ -2,15 +2,15 @@
// edition:2018 // edition:2018
// compile-flags: --crate-type lib // compile-flags: --crate-type lib
use std::{ use std::{cell::RefCell, fmt::Debug, rc::Rc};
cell::RefCell,
fmt::Debug,
rc::Rc,
};
fn non_sync() -> impl Debug { RefCell::new(()) } fn non_sync() -> impl Debug {
RefCell::new(())
}
fn non_send() -> impl Debug { Rc::new(()) } fn non_send() -> impl Debug {
Rc::new(())
}
fn take_ref<T>(_: &T) {} fn take_ref<T>(_: &T) {}
@ -53,5 +53,4 @@ pub fn pass_assert() {
//~^ ERROR future cannot be sent between threads safely //~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call()); assert_send(non_sync_with_method_call());
//~^ ERROR future cannot be sent between threads safely //~^ ERROR future cannot be sent between threads safely
//~^^ ERROR future cannot be sent between threads safely
} }

View File

@ -62,27 +62,5 @@ LL | }
LL | } LL | }
| - `f` is later dropped here | - `f` is later dropped here
error: future cannot be sent between threads safely error: aborting due to 3 previous errors
--> $DIR/async-fn-nonsend.rs:54:5
|
LL | fn assert_send(_: impl Send) {}
| ----------- ---- required by this bound in `assert_send`
...
LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `std::fmt::ArgumentV1<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:43:9
|
LL | let f: &mut std::fmt::Formatter = panic!();
| - has type `&mut std::fmt::Formatter<'_>`
LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await;
| ^^^^^^^^^^^ await occurs here, with `f` maybe used later
LL | }
LL | }
| - `f` is later dropped here
error: aborting due to 4 previous errors