1 // rustfmt-normalize_comments: true
types()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 
issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String)17 fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {}
18 
impl_trait_fn_1() -> impl Fn(i32) -> Option<u8>19 fn impl_trait_fn_1() -> impl Fn(i32) -> Option<u8> {}
20 
impl_trait_fn_2<E>() -> impl Future<Item=&'a i64,Error=E>21 fn impl_trait_fn_2<E>() -> impl Future<Item=&'a i64,Error=E> {}
22 
issue_1234()23 fn issue_1234() {
24     do_parse!(name: take_while1!(is_token) >> (Header))
25 }
26 
27 // #2510
28 impl CombineTypes {
pop_callback( &self, query_id: Uuid, ) -> Option< ( ProjectId, Box<FnMut(&ProjectState, serde_json::Value, bool) -> () + Sync + Send>, ), >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 }
41 
42 // #2859
do_something<'a, T: Trait1 + Trait2 + 'a>(&fooo: u32) -> impl Future< Item = ( impl Future<Item = ( ), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError > + 'a, ), Error = SomeError, > + 'a43 pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(&fooo: u32) -> impl Future<
44     Item = (
45         impl Future<Item = (
46         ), Error =   SomeError> + 'a,
47         impl Future<Item = (), Error = SomeError> + 'a,
48 impl Future<Item = (), Error = SomeError > + 'a,
49     ),
50     Error = SomeError,
51     >
52     +
53     'a {
54 }
55 
do_something<'a, T: Trait1 + Trait2 + 'a>( &fooo: u32, ) -> impl Future< Item = ( impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, ), Error = SomeError, > + Future< Item = ( impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, ), Error = SomeError, > + Future< Item = ( impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, impl Future<Item = (), Error = SomeError> + 'a, ), Error = SomeError, > + 'a + 'b + 'c56 pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(    &fooo: u32,
57 ) -> impl Future<
58     Item = (
59 impl Future<Item = (), Error = SomeError> + 'a,
60         impl Future<Item = (), Error = SomeError> + 'a,
61         impl Future<Item = (), Error = SomeError> + 'a,
62     ),
63     Error = SomeError,
64     >
65     + Future<
66     Item = (
67         impl Future<Item = (), Error = SomeError> + 'a,
68 impl Future<Item = (), Error = SomeError> + 'a,
69         impl Future<Item = (), Error = SomeError> + 'a,
70     ),
71     Error = SomeError,
72         >
73     + Future<
74     Item = (
75         impl Future<Item = (), Error = SomeError> + 'a,
76    impl Future<Item = (), Error = SomeError> + 'a,
77         impl Future<Item = (), Error = SomeError> + 'a,
78     ),
79     Error = SomeError,
80         >
81     +
82     'a + 'b +
83     'c {
84 }
85 
86 // #3051
87 token![impl];
88 token![ impl ];
89 
90 // #3060
91 macro_rules! foo {
92     ($foo_api: ty) => {
93         type Target = ( $foo_api ) + 'static;
94     }
95 }
96 
97 type Target = ( FooAPI ) + 'static;
98 
99 // #3137
foo<T>(t: T) where T: ( FnOnce() -> () ) + Clone, U: ( FnOnce() -> () ) + 'static,100 fn foo<T>(t: T)
101 where
102     T: ( FnOnce() -> () ) + Clone,
103     U: ( FnOnce() -> () ) + 'static,
104 {
105 }
106 
107 // #3117
issue3117()108 fn issue3117() {
109     {
110         {
111             {
112                 {
113                     {
114                         {
115                             {
116                                 {
117                                     let opt: &mut Option<MyLongTypeHere> =
118                                         unsafe { &mut *self.future.get() };
119                                 }
120                             }
121                         }
122                     }
123                 }
124             }
125         }
126     }
127 }
128 
129 // #3139
issue3139()130 fn issue3139() {
131     assert_eq!(
132         to_json_value(&None ::  <i32>).unwrap(),
133         json!(  { "test": None  ::  <i32> }  )
134     );
135 }
136 
137 // #3180
foo(a: SomeLongComplexType, b: SomeOtherLongComplexType) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>138 fn foo(a: SomeLongComplexType, b: SomeOtherLongComplexType) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>> {
139 }
140 
141 type MyFn = fn(a: SomeLongComplexType, b: SomeOtherLongComplexType,) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>;
142 
143 // Const bound
144 
145 trait T: ~   const  Super {}
146 
not_quite_const<S: ~ const T>() -> i32147 const fn not_quite_const<S: ~  const    T>() -> i32 { <S as T>::CONST }
148 
149 struct S<T:~  const   ?  Sized>(std::marker::PhantomData<T>);
150 
151 impl ~    const T {}
152 
apit(_: impl ~ const T)153 fn apit(_: impl ~   const T) {}
154 
rpit() -> impl ~ const T155 fn rpit() -> impl ~  const T { S }
156 
157 pub struct Foo<T: Trait>(T);
158 impl<T:   ~  const Trait> Foo<T> {
new(t: T) -> Self159     fn new(t: T) -> Self {
160         Self(t)
161     }
162 }
163 
164 // #4357
165 type T = typeof(
166 1);
167 impl T for  .. {
168 }
169