@@ -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;
@@ -909,30 +909,32 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
909
909
split_or_candidate |= self . simplify_candidate ( candidate) ;
910
910
}
911
911
912
- if split_or_candidate {
913
- // At least one of the candidates has been split into subcandidates.
914
- // We need to change the candidate list to include those.
915
- let mut new_candidates = Vec :: new ( ) ;
912
+ ensure_sufficient_stack ( || {
913
+ if split_or_candidate {
914
+ // At least one of the candidates has been split into subcandidates.
915
+ // We need to change the candidate list to include those.
916
+ let mut new_candidates = Vec :: new ( ) ;
916
917
917
- for candidate in candidates {
918
- candidate. visit_leaves ( |leaf_candidate| new_candidates. push ( leaf_candidate) ) ;
918
+ for candidate in candidates {
919
+ candidate. visit_leaves ( |leaf_candidate| new_candidates. push ( leaf_candidate) ) ;
920
+ }
921
+ self . match_simplified_candidates (
922
+ span,
923
+ start_block,
924
+ otherwise_block,
925
+ & mut * new_candidates,
926
+ fake_borrows,
927
+ ) ;
928
+ } else {
929
+ self . match_simplified_candidates (
930
+ span,
931
+ start_block,
932
+ otherwise_block,
933
+ candidates,
934
+ fake_borrows,
935
+ ) ;
919
936
}
920
- self . match_simplified_candidates (
921
- span,
922
- start_block,
923
- otherwise_block,
924
- & mut * new_candidates,
925
- fake_borrows,
926
- ) ;
927
- } else {
928
- self . match_simplified_candidates (
929
- span,
930
- start_block,
931
- otherwise_block,
932
- candidates,
933
- fake_borrows,
934
- ) ;
935
- } ;
937
+ } ) ;
936
938
}
937
939
938
940
fn match_simplified_candidates (
0 commit comments