give a more informative failure in this case

This commit is contained in:
Niko Matsakis 2018-09-13 13:40:15 -04:00
parent 632f9c4d6e
commit 7b2aeca10a

View file

@ -51,7 +51,14 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
let mut selcx =
SelectionContext::with_query_mode(&self, TraitQueryMode::Standard);
selcx.evaluate_obligation_recursively(obligation)
.expect("Overflow should be caught earlier in standard query mode")
.unwrap_or_else(|r| {
span_bug!(
obligation.cause.span,
"Overflow should be caught earlier in standard query mode: {:?}, {:?}",
obligation,
r,
)
})
}
}
}