@@ -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:
@@ -720,11 +717,8 @@ impl<'tcx> Cx<'tcx> {
720
717
} ,
721
718
hir:: ExprKind :: Loop ( body, ..) => {
722
719
let block_ty = self . typeck_results ( ) . node_type ( body. hir_id ) ;
723
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
724
- scope_map. temporary_scope_new ( body. hir_id . local_id )
725
- } else {
726
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , body. hir_id . local_id )
727
- } ;
720
+ let temp_lifetime =
721
+ self . scope_map . temporary_scope ( self . rvalue_scopes , body. hir_id . local_id ) ;
728
722
let block = self . mirror_block ( body) ;
729
723
let body = self . thir . exprs . push ( Expr {
730
724
ty : block_ty,
@@ -833,11 +827,8 @@ impl<'tcx> Cx<'tcx> {
833
827
span : Span ,
834
828
overloaded_callee : Option < Ty < ' tcx > > ,
835
829
) -> Expr < ' tcx > {
836
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
837
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
838
- } else {
839
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
840
- } ;
830
+ let temp_lifetime =
831
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
841
832
let ( ty, user_ty) = match overloaded_callee {
842
833
Some ( fn_def) => ( fn_def, None ) ,
843
834
None => {
@@ -923,11 +914,8 @@ impl<'tcx> Cx<'tcx> {
923
914
// a constant reference (or constant raw pointer for `static mut`) in MIR
924
915
Res :: Def ( DefKind :: Static ( _) , id) => {
925
916
let ty = self . tcx . static_ptr_ty ( id) ;
926
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
927
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
928
- } else {
929
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
930
- } ;
917
+ let temp_lifetime =
918
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
931
919
let kind = if self . tcx . is_thread_local_static ( id) {
932
920
ExprKind :: ThreadLocalRef ( id)
933
921
} else {
@@ -1006,11 +994,8 @@ impl<'tcx> Cx<'tcx> {
1006
994
1007
995
// construct the complete expression `foo()` for the overloaded call,
1008
996
// which will yield the &T type
1009
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1010
- scope_map. temporary_scope_new ( expr. hir_id . local_id )
1011
- } else {
1012
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
1013
- } ;
997
+ let temp_lifetime =
998
+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
1014
999
let fun = self . method_callee ( expr, span, overloaded_callee) ;
1015
1000
let fun = self . thir . exprs . push ( fun) ;
1016
1001
let fun_ty = self . thir [ fun] . ty ;
@@ -1030,11 +1015,8 @@ impl<'tcx> Cx<'tcx> {
1030
1015
closure_expr : & ' tcx hir:: Expr < ' tcx > ,
1031
1016
place : HirPlace < ' tcx > ,
1032
1017
) -> Expr < ' tcx > {
1033
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1034
- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1035
- } else {
1036
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1037
- } ;
1018
+ let temp_lifetime =
1019
+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
1038
1020
let var_ty = place. base_ty ;
1039
1021
1040
1022
// The result of capture analysis in `rustc_hir_analysis/check/upvar.rs`represents a captured path
@@ -1089,11 +1071,8 @@ impl<'tcx> Cx<'tcx> {
1089
1071
let upvar_capture = captured_place. info . capture_kind ;
1090
1072
let captured_place_expr =
1091
1073
self . convert_captured_hir_place ( closure_expr, captured_place. place . clone ( ) ) ;
1092
- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1093
- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1094
- } else {
1095
- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1096
- } ;
1074
+ let temp_lifetime =
1075
+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
1097
1076
1098
1077
match upvar_capture {
1099
1078
ty:: UpvarCapture :: ByValue => captured_place_expr,
0 commit comments