Skip to content

Commit 61ed813

Browse files
committed
Add test for issue-67893
1 parent 2687894 commit 61ed813

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// edition:2018
2+
3+
use std::sync::{Arc, Mutex};
4+
5+
pub async fn f(_: ()) {}
6+
7+
pub async fn run() {
8+
let x: Arc<Mutex<()>> = unimplemented!();
9+
f(*x.lock().unwrap()).await;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-build: issue_67893.rs
2+
// edition:2018
3+
4+
extern crate issue_67893;
5+
6+
fn g(_: impl Send) {}
7+
8+
fn main() {
9+
g(issue_67893::run())
10+
//~^ ERROR: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0277]: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
2+
--> $DIR/issue-67893.rs:9:5
3+
|
4+
LL | fn g(_: impl Send) {}
5+
| ---- required by this bound in `g`
6+
...
7+
LL | g(issue_67893::run())
8+
| ^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
9+
|
10+
::: $DIR/auxiliary/issue_67893.rs:7:20
11+
|
12+
LL | pub async fn run() {
13+
| - within this `impl std::future::Future`
14+
|
15+
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
16+
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}`
17+
= note: required because it appears within the type `[static generator@DefId(15:11 ~ issue_67893[8787]::run[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]`
18+
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@DefId(15:11 ~ issue_67893[8787]::run[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]>`
19+
= note: required because it appears within the type `impl std::future::Future`
20+
= note: required because it appears within the type `impl std::future::Future`
21+
22+
error: aborting due to previous error
23+
24+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)