@@ -10,7 +10,7 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
10
10
use crate :: build:: { BlockAnd , BlockAndExtension , Builder } ;
11
11
use crate :: build:: { GuardFrame , GuardFrameLocal , LocalsForNode } ;
12
12
use crate :: hair:: { self , * } ;
13
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
13
+ use rustc_data_structures:: { fx:: { FxHashMap , FxHashSet } , stack :: ensure_sufficient_stack } ;
14
14
use rustc_hir:: HirId ;
15
15
use rustc_index:: bit_set:: BitSet ;
16
16
use rustc_middle:: middle:: region;
@@ -907,30 +907,32 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
907
907
split_or_candidate |= self . simplify_candidate ( candidate) ;
908
908
}
909
909
910
- if split_or_candidate {
911
- // At least one of the candidates has been split into subcandidates.
912
- // We need to change the candidate list to include those.
913
- let mut new_candidates = Vec :: new ( ) ;
910
+ ensure_sufficient_stack ( || {
911
+ if split_or_candidate {
912
+ // At least one of the candidates has been split into subcandidates.
913
+ // We need to change the candidate list to include those.
914
+ let mut new_candidates = Vec :: new ( ) ;
914
915
915
- for candidate in candidates {
916
- candidate. visit_leaves ( |leaf_candidate| new_candidates. push ( leaf_candidate) ) ;
916
+ for candidate in candidates {
917
+ candidate. visit_leaves ( |leaf_candidate| new_candidates. push ( leaf_candidate) ) ;
918
+ }
919
+ self . match_simplified_candidates (
920
+ span,
921
+ start_block,
922
+ otherwise_block,
923
+ & mut * new_candidates,
924
+ fake_borrows,
925
+ ) ;
926
+ } else {
927
+ self . match_simplified_candidates (
928
+ span,
929
+ start_block,
930
+ otherwise_block,
931
+ candidates,
932
+ fake_borrows,
933
+ ) ;
917
934
}
918
- self . match_simplified_candidates (
919
- span,
920
- start_block,
921
- otherwise_block,
922
- & mut * new_candidates,
923
- fake_borrows,
924
- ) ;
925
- } else {
926
- self . match_simplified_candidates (
927
- span,
928
- start_block,
929
- otherwise_block,
930
- candidates,
931
- fake_borrows,
932
- ) ;
933
- } ;
935
+ } ) ;
934
936
}
935
937
936
938
fn match_simplified_candidates (
0 commit comments