summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/future_not_send.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/future_not_send.rs')
-rw-r--r--src/tools/clippy/tests/ui/future_not_send.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/future_not_send.rs b/src/tools/clippy/tests/ui/future_not_send.rs
index 858036692..9274340b5 100644
--- a/src/tools/clippy/tests/ui/future_not_send.rs
+++ b/src/tools/clippy/tests/ui/future_not_send.rs
@@ -5,10 +5,12 @@ use std::rc::Rc;
use std::sync::Arc;
async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
+ //~^ ERROR: future cannot be sent between threads safely
async { true }.await
}
pub async fn public_future(rc: Rc<[u8]>) {
+ //~^ ERROR: future cannot be sent between threads safely
async { true }.await;
}
@@ -17,10 +19,12 @@ pub async fn public_send(arc: Arc<[u8]>) -> bool {
}
async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
+ //~^ ERROR: future cannot be sent between threads safely
true
}
pub async fn public_future2(rc: Rc<[u8]>) {}
+//~^ ERROR: future cannot be sent between threads safely
pub async fn public_send2(arc: Arc<[u8]>) -> bool {
false
@@ -32,11 +36,13 @@ struct Dummy {
impl Dummy {
async fn private_future(&self) -> usize {
+ //~^ ERROR: future cannot be sent between threads safely
async { true }.await;
self.rc.len()
}
pub async fn public_future(&self) {
+ //~^ ERROR: future cannot be sent between threads safely
self.private_future().await;
}
@@ -47,11 +53,13 @@ impl Dummy {
}
async fn generic_future<T>(t: T) -> T
+//~^ ERROR: future cannot be sent between threads safely
where
T: Send,
{
let rt = &t;
async { true }.await;
+ let _ = rt;
t
}
@@ -63,6 +71,7 @@ where
}
async fn unclear_future<T>(t: T) {}
+//~^ ERROR: future cannot be sent between threads safely
fn main() {
let rc = Rc::new([1, 2, 3]);