@@ -526,7 +526,8 @@ impl Visitor {
526526 fn take_sig_specs < TType : ToTokens > (
527527 & mut self ,
528528 spec : & mut SignatureSpec ,
529- ret_pat : Option < ( & Pat , & TType ) > ,
529+ ret_pat : Option < & Pat > ,
530+ ret_ty : Option < & TType > ,
530531 _span : Span ,
531532 is_impl_fn : bool , // is the function a ImplItemFn or TraitImplFn
532533 is_closure : bool , // some closures also use this function to handle
@@ -545,11 +546,6 @@ impl Visitor {
545546
546547 let ( self_token_op, args) = inputs;
547548
548- let ( ret_pat, ret_ty) = match ret_pat {
549- Some ( ( pat, ty) ) => ( Some ( pat) , Some ( ty) ) ,
550- None => ( None , None ) ,
551- } ;
552-
553549 let ret_val_ident: Ident = Ident :: new ( "_VERUS_ret_ident" , Span :: call_site ( ) ) ;
554550
555551 fn wrap_with_ret_binding_pat ( expr : & mut Expr , ret_val_ident : & Ident , ret_pat : & Pat ) {
@@ -874,9 +870,9 @@ impl Visitor {
874870
875871 arg. tracked = None ;
876872 }
877- let ret_pat = match & mut sig. output {
878- ReturnType :: Default => None ,
879- ReturnType :: Type ( _, ref mut tracked, ref mut ret_opt, ty) => {
873+ let ( ret_pat, ret_ty ) = match & mut sig. output {
874+ ReturnType :: Default => ( None , None ) ,
875+ ReturnType :: Type ( _, ref mut tracked, ref mut ret_opt, ref mut ty) => {
880876 self . visit_type_mut ( ty) ;
881877 if let Some ( token) = tracked {
882878 if !self . erase_ghost . erase_all ( ) {
@@ -885,8 +881,8 @@ impl Visitor {
885881 * tracked = None ;
886882 }
887883 match std:: mem:: take ( ret_opt) {
888- None => None ,
889- Some ( ret) => Some ( ( ret. 1 . clone ( ) , ty. clone ( ) ) ) ,
884+ None => ( None , None ) ,
885+ Some ( ret) => ( Some ( ret. 1 ) , Some ( * ty. clone ( ) ) ) ,
890886 }
891887 }
892888 } ;
@@ -1032,15 +1028,16 @@ impl Visitor {
10321028
10331029 let sig_span = sig. span ( ) . clone ( ) ;
10341030
1035- if let Some ( ( p , _ ) ) = & ret_pat {
1036- if let Some ( err_stmt) = check_verus_return_idents ( p , & sig. inputs ) {
1031+ if let Some ( pat ) = & ret_pat {
1032+ if let Some ( err_stmt) = check_verus_return_idents ( pat , & sig. inputs ) {
10371033 stmts. push ( err_stmt) ;
10381034 }
10391035 }
10401036
10411037 let spec_stmts = self . take_sig_specs (
10421038 & mut sig. spec ,
1043- ret_pat. as_ref ( ) . map ( |( pat, ty) | ( pat, ty) ) ,
1039+ ret_pat. as_ref ( ) ,
1040+ ret_ty. as_ref ( ) ,
10441041 sig_span,
10451042 is_impl_fn,
10461043 false ,
@@ -5011,9 +5008,9 @@ pub(crate) fn sig_specs_attr(
50115008 spec_stmts. extend ( take_sig_with_spec ( erase_ghost, with, sig, & mut ret_pat) ) ;
50125009 }
50135010 spec. with = None ;
5014- let ret_pat = match ( & ret_pat, & sig. output ) {
5015- ( Some ( pat) , syn:: ReturnType :: Type ( _, ty) ) => Some ( ( pat, ty ) ) ,
5016- _ => None ,
5011+ let ( ret_pat, ret_ty ) = match ( & ret_pat, & sig. output ) {
5012+ ( Some ( pat) , syn:: ReturnType :: Type ( _, ty) ) => ( Some ( pat) , Some ( ty . as_ref ( ) ) ) ,
5013+ _ => ( None , None ) ,
50175014 } ;
50185015 let mut visitor = Visitor {
50195016 erase_ghost,
@@ -5027,8 +5024,8 @@ pub(crate) fn sig_specs_attr(
50275024 rustdoc : env_rustdoc ( ) ,
50285025 } ;
50295026
5030- if let Some ( ( p , _ ) ) = ret_pat {
5031- if let Some ( err_stmt) = check_return_idents ( p , & sig. inputs ) {
5027+ if let Some ( pat ) = ret_pat {
5028+ if let Some ( err_stmt) = check_return_idents ( pat , & sig. inputs ) {
50325029 spec_stmts. push ( err_stmt) ;
50335030 }
50345031 }
@@ -5037,6 +5034,7 @@ pub(crate) fn sig_specs_attr(
50375034 spec_stmts. extend ( visitor. take_sig_specs (
50385035 & mut spec,
50395036 ret_pat,
5037+ ret_ty,
50405038 sig_span,
50415039 is_impl_fn,
50425040 is_closure,
0 commit comments