]> git.lizzy.rs Git - rust.git/blob - tests/target/type.rs
nightly-0.99.3
[rust.git] / tests / target / 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(
14         x: u8,
15         // comment 4
16         y: String, // comment 3
17         z: Foo,
18         // comment
19         ... // comment 2
20     ),
21 }
22
23 fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {}
24
25 fn impl_trait_fn_1() -> impl Fn(i32) -> Option<u8> {}
26
27 fn impl_trait_fn_2<E>() -> impl Future<Item = &'a i64, Error = E> {}
28
29 fn issue_1234() {
30     do_parse!(name: take_while1!(is_token) >> (Header))
31 }
32
33 // #2510
34 impl CombineTypes {
35     pub fn pop_callback(
36         &self,
37         query_id: Uuid,
38     ) -> Option<(
39         ProjectId,
40         Box<FnMut(&ProjectState, serde_json::Value, bool) -> () + Sync + Send>,
41     )> {
42         self.query_callbacks()(&query_id)
43     }
44 }
45
46 // #2859
47 pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(
48     &fooo: u32,
49 ) -> impl Future<
50     Item = (
51         impl Future<Item = (), Error = SomeError> + 'a,
52         impl Future<Item = (), Error = SomeError> + 'a,
53         impl Future<Item = (), Error = SomeError> + 'a,
54     ),
55     Error = SomeError,
56 > + 'a {
57 }
58
59 pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(
60     &fooo: u32,
61 ) -> impl Future<
62     Item = (
63         impl Future<Item = (), Error = SomeError> + 'a,
64         impl Future<Item = (), Error = SomeError> + 'a,
65         impl Future<Item = (), Error = SomeError> + 'a,
66     ),
67     Error = SomeError,
68 > + Future<
69     Item = (
70         impl Future<Item = (), Error = SomeError> + 'a,
71         impl Future<Item = (), Error = SomeError> + 'a,
72         impl Future<Item = (), Error = SomeError> + 'a,
73     ),
74     Error = SomeError,
75 > + Future<
76     Item = (
77         impl Future<Item = (), Error = SomeError> + 'a,
78         impl Future<Item = (), Error = SomeError> + 'a,
79         impl Future<Item = (), Error = SomeError> + 'a,
80     ),
81     Error = SomeError,
82 > + 'a + 'b + 'c {
83 }