@@ -10,6 +10,7 @@ use std::mem;
1010
1111use  rustc_data_structures:: fx:: FxHashMap ; 
1212use  rustc_hir as  hir; 
13+ use  rustc_hir:: def:: { DefKind ,  Res } ; 
1314use  rustc_hir:: def_id:: DefId ; 
1415use  rustc_hir:: intravisit:: { self ,  Visitor } ; 
1516use  rustc_hir:: { Arm ,  Block ,  Expr ,  LetStmt ,  Pat ,  PatKind ,  Stmt } ; 
@@ -752,13 +753,16 @@ fn resolve_local<'tcx>(
752753                    record_rvalue_scope_if_borrow_expr ( visitor,  arm. body ,  blk_id) ; 
753754                } 
754755            } 
755-             hir:: ExprKind :: Call ( ..)  | hir:: ExprKind :: MethodCall ( ..)  => { 
756-                 // FIXME(@dingxiangfei2009): choose call arguments here 
757-                 // for candidacy for extended parameter rule application 
758-             } 
759-             hir:: ExprKind :: Index ( ..)  => { 
760-                 // FIXME(@dingxiangfei2009): select the indices 
761-                 // as candidate for rvalue scope rules 
756+             hir:: ExprKind :: Call ( func,  args)  => { 
757+                 // Recurse into tuple constructors, such as `Some(&temp())`. 
758+                 if  let  hir:: ExprKind :: Path ( path)  = & func. kind 
759+                     && let  hir:: QPath :: Resolved ( None ,  path)  = path
760+                     && let  Res :: SelfCtor ( ..)  | Res :: Def ( DefKind :: Ctor ( ..) ,  _)  = path. res 
761+                 { 
762+                     for  arg in  args { 
763+                         record_rvalue_scope_if_borrow_expr ( visitor,  arg,  blk_id) ; 
764+                     } 
765+                 } 
762766            } 
763767            _ => { } 
764768        } 
0 commit comments