@@ -189,7 +189,7 @@ impl<'i> InterfaceGenerator<'i> {
189
189
sig. self_arg = Some ( "&self" . into ( ) ) ;
190
190
sig. self_is_first_param = true ;
191
191
}
192
- self . print_signature ( func, true , & sig, false ) ;
192
+ self . print_signature ( func, true , & sig) ;
193
193
self . src . push_str ( ";\n " ) ;
194
194
let trait_method = mem:: replace ( & mut self . src , prev) ;
195
195
methods. push ( trait_method) ;
@@ -959,7 +959,7 @@ pub mod vtable{ordinal} {{
959
959
}
960
960
}
961
961
self . src . push_str ( "#[allow(unused_unsafe, clippy::all)]\n " ) ;
962
- let params = self . print_signature ( func, false , & sig, true ) ;
962
+ let params = self . print_signature ( func, false , & sig) ;
963
963
self . src . push_str ( "{\n " ) ;
964
964
self . src . push_str ( "unsafe {\n " ) ;
965
965
@@ -1099,7 +1099,7 @@ pub mod vtable{ordinal} {{
1099
1099
// The corresponding close bracket is emitted in the
1100
1100
// `Instruction::AsyncPostCallInterface` case inside
1101
1101
// `FunctionBindgen::emit`.
1102
- uwriteln ! ( self . src, "let {name} = {{" ) ;
1102
+ uwriteln ! ( self . src, "let {name} = async move {{" ) ;
1103
1103
}
1104
1104
for decl in handle_decls {
1105
1105
self . src . push_str ( & decl) ;
@@ -1326,14 +1326,8 @@ pub mod vtable{ordinal} {{
1326
1326
sig. self_arg = Some ( "&self" . into ( ) ) ;
1327
1327
sig. self_is_first_param = true ;
1328
1328
}
1329
- self . print_signature ( func, true , & sig, false ) ;
1330
- let call = if async_ {
1331
- let async_support = self . path_to_async_support ( ) ;
1332
- format ! ( "{{ #[allow(unreachable_code)]{async_support}::futures::future::ready(unreachable!()) }}\n " )
1333
- } else {
1334
- "{ unreachable!() }\n " . into ( )
1335
- } ;
1336
- self . src . push_str ( & call) ;
1329
+ self . print_signature ( func, true , & sig) ;
1330
+ self . src . push_str ( "{ unreachable!() }\n " ) ;
1337
1331
}
1338
1332
1339
1333
self . src . push_str ( "}\n " ) ;
@@ -1390,22 +1384,12 @@ pub mod vtable{ordinal} {{
1390
1384
// }
1391
1385
}
1392
1386
1393
- fn print_signature (
1394
- & mut self ,
1395
- func : & Function ,
1396
- params_owned : bool ,
1397
- sig : & FnSig ,
1398
- use_async_sugar : bool ,
1399
- ) -> Vec < String > {
1400
- let params = self . print_docs_and_params ( func, params_owned, sig, use_async_sugar) ;
1387
+ fn print_signature ( & mut self , func : & Function , params_owned : bool , sig : & FnSig ) -> Vec < String > {
1388
+ let params = self . print_docs_and_params ( func, params_owned, sig) ;
1401
1389
if let FunctionKind :: Constructor ( _) = & func. kind {
1402
- self . push_str ( if sig. async_ && !use_async_sugar {
1403
- " -> impl ::core::future::Future<Output = Self>"
1404
- } else {
1405
- " -> Self"
1406
- } )
1390
+ self . push_str ( " -> Self" )
1407
1391
} else {
1408
- self . print_results ( & func. results , sig . async_ && !use_async_sugar ) ;
1392
+ self . print_results ( & func. results ) ;
1409
1393
}
1410
1394
params
1411
1395
}
@@ -1415,7 +1399,6 @@ pub mod vtable{ordinal} {{
1415
1399
func : & Function ,
1416
1400
params_owned : bool ,
1417
1401
sig : & FnSig ,
1418
- use_async_sugar : bool ,
1419
1402
) -> Vec < String > {
1420
1403
self . rustdoc ( & func. docs ) ;
1421
1404
self . rustdoc_params ( & func. params , "Parameters" ) ;
@@ -1428,7 +1411,7 @@ pub mod vtable{ordinal} {{
1428
1411
if sig. unsafe_ {
1429
1412
self . push_str ( "unsafe " ) ;
1430
1413
}
1431
- if sig. async_ && use_async_sugar {
1414
+ if sig. async_ {
1432
1415
self . push_str ( "async " ) ;
1433
1416
}
1434
1417
self . push_str ( "fn " ) ;
@@ -1518,11 +1501,8 @@ pub mod vtable{ordinal} {{
1518
1501
params
1519
1502
}
1520
1503
1521
- fn print_results ( & mut self , results : & Results , async_ : bool ) {
1504
+ fn print_results ( & mut self , results : & Results ) {
1522
1505
self . push_str ( " -> " ) ;
1523
- if async_ {
1524
- self . push_str ( "impl ::core::future::Future<Output = " ) ;
1525
- }
1526
1506
1527
1507
match results. len ( ) {
1528
1508
0 => {
@@ -1545,10 +1525,6 @@ pub mod vtable{ordinal} {{
1545
1525
self . push_str ( ")" )
1546
1526
}
1547
1527
}
1548
-
1549
- if async_ {
1550
- self . push_str ( "> + 'static" ) ;
1551
- }
1552
1528
}
1553
1529
1554
1530
/// Calculates the `TypeMode` to be used for the `ty` specified.
0 commit comments