Auto merge of #81055 - matthewjasper:non-fatal-overflow, r=nikomatsakis
Make hitting the recursion limit in projection non-fatal This change was originally made in #80246 to avoid future (effectively) infinite loop bugs in projections, but wundergraph relies on rustc recovering here. cc #80953 r? `@nikomatsakis`
This commit is contained in:
commit
c0b64d97be
4 changed files with 63 additions and 13 deletions
|
@ -736,14 +736,9 @@ fn project_type<'cx, 'tcx>(
|
|||
|
||||
if !selcx.tcx().sess.recursion_limit().value_within_limit(obligation.recursion_depth) {
|
||||
debug!("project: overflow!");
|
||||
match selcx.query_mode() {
|
||||
super::TraitQueryMode::Standard => {
|
||||
selcx.infcx().report_overflow_error(&obligation, true);
|
||||
}
|
||||
super::TraitQueryMode::Canonical => {
|
||||
return Err(ProjectionTyError::TraitSelectionError(SelectionError::Overflow));
|
||||
}
|
||||
}
|
||||
// This should really be an immediate error, but some existing code
|
||||
// relies on being able to recover from this.
|
||||
return Err(ProjectionTyError::TraitSelectionError(SelectionError::Overflow));
|
||||
}
|
||||
|
||||
let obligation_trait_ref = &obligation.predicate.trait_ref(selcx.tcx());
|
||||
|
|
|
@ -291,10 +291,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
self.infcx.tcx
|
||||
}
|
||||
|
||||
pub(super) fn query_mode(&self) -> TraitQueryMode {
|
||||
self.query_mode
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Selection
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue