]> git.lizzy.rs Git - rust.git/blob - tests/ui/typeck/issue-107775.rs
Remove astconv usage in diagnostic
[rust.git] / tests / ui / typeck / issue-107775.rs
1 // edition: 2021
2
3 use std::collections::HashMap;
4 use std::future::Future;
5 use std::pin::Pin;
6
7 pub trait Trait {
8     fn do_something<'async_trait>(byte: u8)
9     ->
10         Pin<Box<dyn Future<Output = ()> +
11         Send + 'async_trait>>;
12 }
13
14 pub struct Struct;
15
16 impl Trait for Struct {
17     fn do_something<'async_trait>(byte: u8)
18         ->
19             Pin<Box<dyn Future<Output = ()> +
20             Send + 'async_trait>> {
21         Box::pin(
22
23             async move { let byte = byte; let _: () = {}; })
24     }
25 }
26
27 pub struct Map {
28     map: HashMap<u16, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>>>,
29 }
30
31 impl Map {
32     pub fn new() -> Self {
33         let mut map = HashMap::new();
34         map.insert(1, Struct::do_something);
35         Self { map }
36         //~^ ERROR mismatched types
37     }
38 }
39
40 fn main() {}