]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
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 | } | |
41 | ||
42 | // #2859 | |
43 | 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 | ||
56 | 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 | |
100 | fn foo<T>(t: T) | |
101 | where | |
102 | T: ( FnOnce() -> () ) + Clone, | |
103 | U: ( FnOnce() -> () ) + 'static, | |
104 | { | |
105 | } | |
106 | ||
107 | // #3117 | |
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 | |
130 | fn issue3139() { | |
131 | assert_eq!( | |
132 | to_json_value(&None :: <i32>).unwrap(), | |
133 | json!( { "test": None :: <i32> } ) | |
134 | ); | |
135 | } | |
136 | ||
137 | // #3180 | |
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 | ||
94222f64 | 143 | // Const bound |
f20569fa | 144 | |
94222f64 | 145 | trait T: ~ const Super {} |
f20569fa | 146 | |
94222f64 | 147 | const fn not_quite_const<S: ~ const T>() -> i32 { <S as T>::CONST } |
f20569fa | 148 | |
94222f64 | 149 | struct S<T:~ const ? Sized>(std::marker::PhantomData<T>); |
f20569fa | 150 | |
94222f64 | 151 | impl ~ const T {} |
f20569fa | 152 | |
94222f64 | 153 | fn apit(_: impl ~ const T) {} |
f20569fa | 154 | |
94222f64 | 155 | fn rpit() -> impl ~ const T { S } |
f20569fa XL |
156 | |
157 | pub struct Foo<T: Trait>(T); | |
94222f64 | 158 | impl<T: ~ const Trait> Foo<T> { |
f20569fa | 159 | fn new(t: T) -> Self { |
f20569fa XL |
160 | Self(t) |
161 | } | |
162 | } | |
163 | ||
164 | // #4357 | |
165 | type T = typeof( | |
166 | 1); | |
167 | impl T for .. { | |
94222f64 | 168 | } |