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