Make recursion limit fatal in project

This avoid the hang/oom from #79714
This commit is contained in:
Matthew Jasper 2020-12-20 18:11:11 +00:00
parent 2ad5292aea
commit 77fce67733
2 changed files with 9 additions and 3 deletions

View file

@ -734,7 +734,14 @@ fn project_type<'cx, 'tcx>(
if !selcx.tcx().sess.recursion_limit().value_within_limit(obligation.recursion_depth) {
debug!("project: overflow!");
return Err(ProjectionTyError::TraitSelectionError(SelectionError::Overflow));
match selcx.query_mode() {
super::TraitQueryMode::Standard => {
selcx.infcx().report_overflow_error(&obligation, true);
}
super::TraitQueryMode::Canonical => {
return Err(ProjectionTyError::TraitSelectionError(SelectionError::Overflow));
}
}
}
let obligation_trait_ref = &obligation.predicate.trait_ref(selcx.tcx());