@@ -236,11 +236,8 @@ impl<'tcx> Cx<'tcx> {
236
236
fn make_mirror_unadjusted ( & mut self , expr : & ' tcx hir:: Expr < ' tcx > ) -> Expr < ' tcx > {
237
237
let tcx = self . tcx ;
238
238
let expr_ty = self . typeck_results ( ) . expr_ty ( expr) ;
239
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
240
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
241
- } else {
242
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
243
- } ;
239
+ let temp_lifetime =
240
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
244
241
245
242
let kind = match expr. kind {
246
243
// Here comes the interesting stuff:
@@ -717,11 +714,8 @@ impl<'tcx> Cx<'tcx> {
717
714
} ,
718
715
hir:: ExprKind :: Loop ( body, ..) => {
719
716
let block_ty = self . typeck_results ( ) . node_type ( body. hir_id ) ;
720
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
721
- scope_map. temporary_scope_new ( body. hir_id . local_id )
722
- } else {
723
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , body. hir_id . local_id )
724
- } ;
717
+ let temp_lifetime =
718
+ self . scope_map . temporary_scope ( self . rvalue_scopes , body. hir_id . local_id ) ;
725
719
let block = self . mirror_block ( body) ;
726
720
let body = self . thir . exprs . push ( Expr {
727
721
ty : block_ty,
@@ -830,11 +824,8 @@ impl<'tcx> Cx<'tcx> {
830
824
span : Span ,
831
825
overloaded_callee : Option < Ty < ' tcx > > ,
832
826
) -> Expr < ' tcx > {
833
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
834
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
835
- } else {
836
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
837
- } ;
827
+ let temp_lifetime =
828
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
838
829
let ( ty, user_ty) = match overloaded_callee {
839
830
Some ( fn_def) => ( fn_def, None ) ,
840
831
None => {
@@ -920,11 +911,8 @@ impl<'tcx> Cx<'tcx> {
920
911
// a constant reference (or constant raw pointer for `static mut`) in MIR
921
912
Res :: Def ( DefKind :: Static ( _) , id) => {
922
913
let ty = self . tcx . static_ptr_ty ( id) ;
923
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
924
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
925
- } else {
926
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
927
- } ;
914
+ let temp_lifetime =
915
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
928
916
let kind = if self . tcx . is_thread_local_static ( id) {
929
917
ExprKind :: ThreadLocalRef ( id)
930
918
} else {
@@ -1003,11 +991,8 @@ impl<'tcx> Cx<'tcx> {
1003
991
1004
992
// construct the complete expression `foo()` for the overloaded call,
1005
993
// which will yield the &T type
1006
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1007
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
1008
- } else {
1009
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
1010
- } ;
994
+ let temp_lifetime =
995
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
1011
996
let fun = self . method_callee ( expr, span, overloaded_callee) ;
1012
997
let fun = self . thir . exprs . push ( fun) ;
1013
998
let fun_ty = self . thir [ fun] . ty ;
@@ -1027,11 +1012,8 @@ impl<'tcx> Cx<'tcx> {
1027
1012
closure_expr : & ' tcx hir:: Expr < ' tcx > ,
1028
1013
place : HirPlace < ' tcx > ,
1029
1014
) -> Expr < ' tcx > {
1030
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1031
- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1032
- } else {
1033
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1034
- } ;
1015
+ let temp_lifetime =
1016
+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
1035
1017
let var_ty = place. base_ty ;
1036
1018
1037
1019
// The result of capture analysis in `rustc_hir_analysis/check/upvar.rs`represents a captured path
@@ -1086,11 +1068,8 @@ impl<'tcx> Cx<'tcx> {
1086
1068
let upvar_capture = captured_place. info . capture_kind ;
1087
1069
let captured_place_expr =
1088
1070
self . convert_captured_hir_place ( closure_expr, captured_place. place . clone ( ) ) ;
1089
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1090
- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1091
- } else {
1092
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1093
- } ;
1071
+ let temp_lifetime =
1072
+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
1094
1073
1095
1074
match upvar_capture {
1096
1075
ty:: UpvarCapture :: ByValue => captured_place_expr,
0 commit comments