@@ -157,9 +157,11 @@ pub unsafe trait UnsafeTrait {}
157
157
unsafe impl UnsafeTrait for ( ) { }
158
158
159
159
#[ async_trait]
160
+ #[ allow( dead_code) ]
160
161
pub ( crate ) unsafe trait UnsafeTraitPubCrate { }
161
162
162
163
#[ async_trait]
164
+ #[ allow( dead_code) ]
163
165
unsafe trait UnsafeTraitPrivate { }
164
166
165
167
pub async fn test_can_destruct ( ) {
@@ -177,6 +179,8 @@ pub async fn test_can_destruct() {
177
179
let _d: u8 = d;
178
180
}
179
181
}
182
+
183
+ let _ = <Struct as CanDestruct >:: f;
180
184
}
181
185
182
186
pub async fn test_self_in_macro ( ) {
@@ -199,6 +203,10 @@ pub async fn test_self_in_macro() {
199
203
println ! ( "{}" , self ) ;
200
204
}
201
205
}
206
+
207
+ let _ = <String as Trait >:: a;
208
+ let _ = <String as Trait >:: b;
209
+ let _ = <String as Trait >:: c;
202
210
}
203
211
204
212
pub async fn test_inference ( ) {
@@ -208,6 +216,10 @@ pub async fn test_inference() {
208
216
Box :: new ( std:: iter:: empty ( ) )
209
217
}
210
218
}
219
+
220
+ impl Trait for ( ) { }
221
+
222
+ let _ = <( ) as Trait >:: f;
211
223
}
212
224
213
225
pub async fn test_internal_items ( ) {
@@ -233,14 +245,18 @@ pub async fn test_unimplemented() {
233
245
unimplemented ! ( )
234
246
}
235
247
}
248
+
249
+ impl Trait for ( ) { }
250
+
251
+ let _ = <( ) as Trait >:: f;
236
252
}
237
253
238
254
// https://github.com/dtolnay/async-trait/issues/1
239
255
pub mod issue1 {
240
256
use async_trait:: async_trait;
241
257
242
258
#[ async_trait]
243
- trait Issue1 {
259
+ pub trait Issue1 {
244
260
async fn f < U > ( & self ) ;
245
261
}
246
262
@@ -284,11 +300,11 @@ pub mod issue11 {
284
300
use std:: sync:: Arc ;
285
301
286
302
#[ async_trait]
287
- trait Issue11 {
303
+ pub trait Issue11 {
288
304
async fn example ( self : Arc < Self > ) ;
289
305
}
290
306
291
- struct Struct ;
307
+ pub struct Struct ;
292
308
293
309
#[ async_trait]
294
310
impl Issue11 for Struct {
@@ -301,10 +317,10 @@ pub mod issue15 {
301
317
use async_trait:: async_trait;
302
318
use std:: marker:: PhantomData ;
303
319
304
- trait Trait { }
320
+ pub trait Trait { }
305
321
306
322
#[ async_trait]
307
- trait Issue15 {
323
+ pub trait Issue15 {
308
324
async fn myfn ( & self , _: PhantomData < dyn Trait + Send > ) { }
309
325
}
310
326
}
@@ -314,11 +330,11 @@ pub mod issue17 {
314
330
use async_trait:: async_trait;
315
331
316
332
#[ async_trait]
317
- trait Issue17 {
333
+ pub trait Issue17 {
318
334
async fn f ( & self ) ;
319
335
}
320
336
321
- struct Struct {
337
+ pub struct Struct {
322
338
string : String ,
323
339
}
324
340
@@ -409,10 +425,10 @@ pub mod issue25 {
409
425
pub mod issue28 {
410
426
use async_trait:: async_trait;
411
427
412
- struct Str < ' a > ( & ' a str ) ;
428
+ pub struct Str < ' a > ( & ' a str ) ;
413
429
414
430
#[ async_trait]
415
- trait Trait1 < ' a > {
431
+ pub trait Trait1 < ' a > {
416
432
async fn f ( x : Str < ' a > ) -> & ' a str ;
417
433
async fn g ( x : Str < ' a > ) -> & ' a str {
418
434
x. 0
@@ -427,7 +443,7 @@ pub mod issue28 {
427
443
}
428
444
429
445
#[ async_trait]
430
- trait Trait2 {
446
+ pub trait Trait2 {
431
447
async fn f ( ) ;
432
448
}
433
449
@@ -437,7 +453,7 @@ pub mod issue28 {
437
453
}
438
454
439
455
#[ async_trait]
440
- trait Trait3 < ' a , ' b > {
456
+ pub trait Trait3 < ' a , ' b > {
441
457
async fn f ( _: & ' a & ' b ( ) ) ; // chain 'a and 'b
442
458
async fn g ( _: & ' b ( ) ) ; // chain 'b only
443
459
async fn h ( ) ; // do not chain
@@ -867,7 +883,7 @@ pub mod issue89 {
867
883
use async_trait:: async_trait;
868
884
869
885
#[ async_trait]
870
- trait Trait {
886
+ pub trait Trait {
871
887
async fn f ( & self ) ;
872
888
}
873
889
@@ -1003,7 +1019,7 @@ pub mod issue104 {
1003
1019
use async_trait:: async_trait;
1004
1020
1005
1021
#[ async_trait]
1006
- trait T1 {
1022
+ pub trait T1 {
1007
1023
async fn id ( & self ) -> i32 ;
1008
1024
}
1009
1025
@@ -1018,7 +1034,7 @@ pub mod issue104 {
1018
1034
} ;
1019
1035
}
1020
1036
1021
- struct Foo ;
1037
+ pub struct Foo ;
1022
1038
1023
1039
impl_t1 ! ( Foo , 1 ) ;
1024
1040
}
@@ -1082,7 +1098,7 @@ pub mod issue120 {
1082
1098
use async_trait:: async_trait;
1083
1099
1084
1100
#[ async_trait]
1085
- trait Trait {
1101
+ pub trait Trait {
1086
1102
async fn f ( & self ) ;
1087
1103
}
1088
1104
@@ -1097,7 +1113,7 @@ pub mod issue123 {
1097
1113
use async_trait:: async_trait;
1098
1114
1099
1115
#[ async_trait]
1100
- trait Trait < T = ( ) > {
1116
+ pub trait Trait < T = ( ) > {
1101
1117
async fn f ( & self ) -> & str
1102
1118
where
1103
1119
T : ' async_trait ,
@@ -1137,7 +1153,7 @@ pub mod issue134 {
1137
1153
use async_trait:: async_trait;
1138
1154
1139
1155
#[ async_trait]
1140
- trait TestTrait {
1156
+ pub trait TestTrait {
1141
1157
async fn run < const DUMMY : bool > ( self )
1142
1158
where
1143
1159
Self : Sized ,
@@ -1284,13 +1300,13 @@ pub mod issue152 {
1284
1300
use async_trait:: async_trait;
1285
1301
1286
1302
#[ async_trait]
1287
- trait Trait {
1303
+ pub trait Trait {
1288
1304
type Assoc ;
1289
1305
1290
1306
async fn f ( & self ) -> Self :: Assoc ;
1291
1307
}
1292
1308
1293
- struct Struct ;
1309
+ pub struct Struct ;
1294
1310
1295
1311
#[ async_trait]
1296
1312
impl Trait for Struct {
@@ -1399,7 +1415,7 @@ pub mod issue183 {
1399
1415
use async_trait:: async_trait;
1400
1416
1401
1417
#[ async_trait]
1402
- trait Foo {
1418
+ pub trait Foo {
1403
1419
async fn foo ( _n : i32 ) { }
1404
1420
}
1405
1421
}
0 commit comments