fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
579 B20 linesraw
1// run-rustfix
2// edition: 2021
3
4#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
5#![allow(unused)]
6
7trait Foo {
8    fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
9    fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
10}
11
12fn bar<T: Foo>() {
13    fn needs_send(_: impl Send) {}
14    needs_send(T::test());
15    //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
16    needs_send(T::test2());
17    //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely
18}
19
20fn main() {}