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