File tree 1 file changed +4
-1
lines changed
compiler/rustc_infer/src/infer/relate
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 1
1
use std:: mem;
2
2
3
3
use rustc_data_structures:: sso:: SsoHashMap ;
4
+ use rustc_data_structures:: stack:: ensure_sufficient_stack;
4
5
use rustc_hir:: def_id:: DefId ;
5
6
use rustc_middle:: infer:: unify_key:: { ConstVarValue , ConstVariableValue } ;
6
7
use rustc_middle:: ty:: error:: TypeError ;
@@ -226,7 +227,9 @@ where
226
227
let old_ambient_variance = self . ambient_variance ;
227
228
self . ambient_variance = self . ambient_variance . xform ( variance) ;
228
229
debug ! ( ?self . ambient_variance, "new ambient variance" ) ;
229
- let r = self . relate ( a, b) ?;
230
+ // Recursive calls to `relate` can overflow the stack. For example a deeper version of
231
+ // `ui/associated-consts/issue-93775.rs`.
232
+ let r = ensure_sufficient_stack ( || self . relate ( a, b) ) ?;
230
233
self . ambient_variance = old_ambient_variance;
231
234
Ok ( r)
232
235
}
You can’t perform that action at this time.
0 commit comments