]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issue-70935-complex-spans.rs
Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
[rust.git] / src / test / ui / async-await / issue-70935-complex-spans.rs
1 // edition:2018
2 // #70935: Check if we do not emit snippet
3 // with newlines which lead complex diagnostics.
4
5 use std::future::Future;
6
7 async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
8 }
9
10 fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
11     //~^ ERROR: future cannot be sent between threads safely
12     async move {
13         baz(|| async{
14             foo(tx.clone());
15         }).await;
16     }
17 }
18
19 fn bar(_s: impl Future + Send) {
20 }
21
22 fn main() {
23     let (tx, _rx) = std::sync::mpsc::channel();
24     bar(foo(tx));
25 }