@@ -10,6 +10,7 @@ use std::mem;
10
10
11
11
use rustc_data_structures:: fx:: FxHashMap ;
12
12
use rustc_hir as hir;
13
+ use rustc_hir:: def:: { DefKind , Res } ;
13
14
use rustc_hir:: def_id:: DefId ;
14
15
use rustc_hir:: intravisit:: { self , Visitor } ;
15
16
use rustc_hir:: { Arm , Block , Expr , LetStmt , Pat , PatKind , Stmt } ;
@@ -752,13 +753,16 @@ fn resolve_local<'tcx>(
752
753
record_rvalue_scope_if_borrow_expr ( visitor, arm. body , blk_id) ;
753
754
}
754
755
}
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
+ }
762
766
}
763
767
_ => { }
764
768
}
0 commit comments