1
Fork 0

Report cycle error using 'deepest' obligation in the cycle

This commit is contained in:
Aaron Hill 2021-08-27 17:34:48 -05:00
parent f2d9ee9c34
commit 611191f54c
No known key found for this signature in database
GPG key ID: B4087E510E98B164
9 changed files with 41 additions and 20 deletions

View file

@ -224,7 +224,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
debug!("report_overflow_error_cycle: cycle={:?}", cycle);
self.report_overflow_error(&cycle[0], false);
// The 'deepest' obligation is most likely to have a useful
// cause 'backtrace'
self.report_overflow_error(cycle.iter().max_by_key(|p| p.recursion_depth).unwrap(), false);
}
fn report_selection_error(