]> git.lizzy.rs Git - rust.git/blob - tests/source/type.rs
Add a test for #2510
[rust.git] / tests / source / type.rs
1 // rustfmt-normalize_comments: true
2 fn types() {
3     let x: [ Vec   < _ > ] = [];
4     let y:  * mut [ SomeType ; konst_funk() ] = expr();
5     let z: (/*#digits*/ usize, /*exp*/ i16) = funk();
6     let z: ( usize  /*#digits*/ , i16 /*exp*/ ) = funk();
7 }
8
9 struct F {
10     f: extern "C" fn(x: u8, ... /* comment */),
11     g: extern "C" fn(x: u8,/* comment */ ...),
12     h: extern "C" fn(x: u8, ... ),
13     i: extern "C" fn(x: u8, /* comment 4*/ y: String, // comment 3
14                      z: Foo, /* comment */ .../* comment 2*/ ),
15 }
16
17 fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {}
18
19 fn impl_trait_fn_1() -> impl Fn(i32) -> Option<u8> {}
20
21 fn impl_trait_fn_2<E>() -> impl Future<Item=&'a i64,Error=E> {}
22
23 fn issue_1234() {
24     do_parse!(name: take_while1!(is_token) >> (Header))
25 }
26
27 // #2510
28 impl CombineTypes {
29     pub fn pop_callback(
30         &self,
31         query_id: Uuid,
32     ) -> Option<
33         (
34             ProjectId,
35             Box<FnMut(&ProjectState, serde_json::Value, bool) -> () + Sync + Send>,
36         ),
37     > {
38         self.query_callbacks()(&query_id)
39     }
40 }