@@ -363,6 +363,7 @@ impl<'a> State<'a> {
363
363
generics,
364
364
arg_names,
365
365
None ,
366
+ None ,
366
367
) ;
367
368
self . end ( ) ; // end head-ibox
368
369
self . word ( ";" ) ;
@@ -522,14 +523,15 @@ impl<'a> State<'a> {
522
523
self . word ( ";" ) ;
523
524
self . end ( ) ; // end the outer cbox
524
525
}
525
- hir:: ItemKind :: Fn ( ref sig, generics, _fn_contract_ids , body) => {
526
+ hir:: ItemKind :: Fn ( ref sig, generics, fn_contract_ids , body) => {
526
527
self . head ( "" ) ;
527
528
self . print_fn (
528
529
sig. decl ,
529
530
sig. header ,
530
531
Some ( item. ident . name ) ,
531
532
generics,
532
533
& [ ] ,
534
+ fn_contract_ids,
533
535
Some ( body) ,
534
536
) ;
535
537
self . word ( " " ) ;
@@ -792,7 +794,7 @@ impl<'a> State<'a> {
792
794
arg_names : & [ Ident ] ,
793
795
body_id : Option < hir:: BodyId > ,
794
796
) {
795
- self . print_fn ( m. decl , m. header , Some ( ident. name ) , generics, arg_names, body_id) ;
797
+ self . print_fn ( m. decl , m. header , Some ( ident. name ) , generics, arg_names, None , body_id) ;
796
798
}
797
799
798
800
fn print_trait_item ( & mut self , ti : & hir:: TraitItem < ' _ > ) {
@@ -1942,6 +1944,7 @@ impl<'a> State<'a> {
1942
1944
name : Option < Symbol > ,
1943
1945
generics : & hir:: Generics < ' _ > ,
1944
1946
arg_names : & [ Ident ] ,
1947
+ fn_contract_ids : Option < & hir:: FnContractIds > ,
1945
1948
body_id : Option < hir:: BodyId > ,
1946
1949
) {
1947
1950
self . print_fn_header_info ( header) ;
@@ -1982,6 +1985,7 @@ impl<'a> State<'a> {
1982
1985
self . pclose ( ) ;
1983
1986
1984
1987
self . print_fn_output ( decl) ;
1988
+ if let Some ( contract_ids) = fn_contract_ids { self . print_contracts ( contract_ids) ; }
1985
1989
self . print_where_clause ( generics)
1986
1990
}
1987
1991
@@ -2146,6 +2150,15 @@ impl<'a> State<'a> {
2146
2150
self . print_ident ( lifetime. ident )
2147
2151
}
2148
2152
2153
+ fn print_contracts ( & mut self , fn_contract_ids : & hir:: FnContractIds ) {
2154
+ if let Some ( precond) = fn_contract_ids. precond {
2155
+ self . ann . nested ( self , Nested :: Body ( precond) ) ;
2156
+ }
2157
+ if let Some ( postcond) = fn_contract_ids. postcond {
2158
+ self . ann . nested ( self , Nested :: Body ( postcond) ) ;
2159
+ }
2160
+ }
2161
+
2149
2162
fn print_where_clause ( & mut self , generics : & hir:: Generics < ' _ > ) {
2150
2163
if generics. predicates . is_empty ( ) {
2151
2164
return ;
@@ -2260,6 +2273,7 @@ impl<'a> State<'a> {
2260
2273
generics,
2261
2274
arg_names,
2262
2275
None ,
2276
+ None ,
2263
2277
) ;
2264
2278
self . end ( ) ;
2265
2279
}
0 commit comments