blob: b1cca5cbb0054031e56c27bcea8da2f89a1ab771 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  | 
// Repro for <https://github.com/rust-lang/rust/issues/71671#issuecomment-848994782>.
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
//@[assumptions] check-pass
//@[no_assumptions] known-bug: #110338
pub trait Robot {
    type Id;
}
pub type DynRobot = Box<dyn Robot<Id = u32> + Send>;
impl Robot for DynRobot {
    type Id = u32;
}
struct IRobot<R: Robot> {
    id: R::Id,
    robot: R,
}
// stand-in for tokio::spawn
fn this_is_send<T: Send>(value: T) -> T {
    value
}
async fn yield_now() {}
fn test(source: DynRobot) {
    let _my_task = this_is_send(async move {
        let _my_iter = IRobot {
            id: 32,
            robot: source,
        };
        yield_now().await;
    });
}
fn main() {}
 
  |