|
1 | 1 | use crate::infer::{InferCtxt, TyOrConstInferVar};
|
| 2 | +use crate::traits::error_reporting::TypeErrCtxtExt; |
2 | 3 | use rustc_data_structures::captures::Captures;
|
3 | 4 | use rustc_data_structures::obligation_forest::ProcessResult;
|
4 | 5 | use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome};
|
@@ -424,6 +425,29 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
424 | 425 | }
|
425 | 426 | }
|
426 | 427 |
|
| 428 | + ty::PredicateKind::Ambiguous => ProcessResult::Unchanged, |
| 429 | + ty::PredicateKind::AliasRelate(..) => { |
| 430 | + bug!("AliasRelate is only used for new solver") |
| 431 | + } |
| 432 | + |
| 433 | + // General case overflow check. Allow `process_trait_obligation` |
| 434 | + // and `process_projection_obligation` to handle checking for |
| 435 | + // the recursion limit themselves. Also don't check some |
| 436 | + // predicate kinds that don't give further obligations. |
| 437 | + _ if !self |
| 438 | + .selcx |
| 439 | + .tcx() |
| 440 | + .recursion_limit() |
| 441 | + .value_within_limit(obligation.recursion_depth) => |
| 442 | + { |
| 443 | + self.selcx.infcx.err_ctxt().report_overflow_error( |
| 444 | + &obligation.predicate, |
| 445 | + obligation.cause.span, |
| 446 | + false, |
| 447 | + |_| {}, |
| 448 | + ); |
| 449 | + } |
| 450 | + |
427 | 451 | ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
|
428 | 452 | match wf::obligations(
|
429 | 453 | self.selcx.infcx,
|
@@ -454,7 +478,12 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
454 | 478 | vec![TyOrConstInferVar::Ty(a), TyOrConstInferVar::Ty(b)];
|
455 | 479 | ProcessResult::Unchanged
|
456 | 480 | }
|
457 |
| - Ok(Ok(ok)) => ProcessResult::Changed(mk_pending(ok.obligations)), |
| 481 | + Ok(Ok(mut ok)) => { |
| 482 | + for subobligation in &mut ok.obligations { |
| 483 | + subobligation.set_depth_from_parent(obligation.recursion_depth); |
| 484 | + } |
| 485 | + ProcessResult::Changed(mk_pending(ok.obligations)) |
| 486 | + } |
458 | 487 | Ok(Err(err)) => {
|
459 | 488 | let expected_found =
|
460 | 489 | ExpectedFound::new(subtype.a_is_expected, subtype.a, subtype.b);
|
@@ -625,10 +654,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
625 | 654 | }
|
626 | 655 | }
|
627 | 656 | }
|
628 |
| - ty::PredicateKind::Ambiguous => ProcessResult::Unchanged, |
629 |
| - ty::PredicateKind::AliasRelate(..) => { |
630 |
| - bug!("AliasRelate is only used for new solver") |
631 |
| - } |
632 | 657 | ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
|
633 | 658 | match self.selcx.infcx.at(&obligation.cause, obligation.param_env).eq(
|
634 | 659 | DefineOpaqueTypes::No,
|
|
0 commit comments