diff options
Diffstat (limited to 'compiler/rustc_infer')
| -rw-r--r-- | compiler/rustc_infer/src/traits/mod.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/traits/structural_impls.rs | 6 | 
2 files changed, 10 insertions, 6 deletions
| diff --git a/compiler/rustc_infer/src/traits/mod.rs b/compiler/rustc_infer/src/traits/mod.rs index 72ec07375ac..4808a1defdd 100644 --- a/compiler/rustc_infer/src/traits/mod.rs +++ b/compiler/rustc_infer/src/traits/mod.rs @@ -135,16 +135,18 @@ pub struct FulfillmentError<'tcx> { #[derive(Clone)] pub enum FulfillmentErrorCode<'tcx> { - /// Inherently impossible to fulfill; this trait is implemented if and only if it is already implemented. + /// Inherently impossible to fulfill; this trait is implemented if and only + /// if it is already implemented. Cycle(Vec<PredicateObligation<'tcx>>), SelectionError(SelectionError<'tcx>), ProjectionError(MismatchedProjectionTypes<'tcx>), SubtypeError(ExpectedFound<Ty<'tcx>>, TypeError<'tcx>), // always comes from a SubtypePredicate ConstEquateError(ExpectedFound<Const<'tcx>>, TypeError<'tcx>), Ambiguity { - /// Overflow reported from the new solver `-Znext-solver`, which will - /// be reported as an regular error as opposed to a fatal error. - overflow: bool, + /// Overflow is only `Some(suggest_recursion_limit)` when using the next generation + /// trait solver `-Znext-solver`. With the old solver overflow is eagerly handled by + /// emitting a fatal error instead. + overflow: Option<bool>, }, } diff --git a/compiler/rustc_infer/src/traits/structural_impls.rs b/compiler/rustc_infer/src/traits/structural_impls.rs index 3b4050fcd27..bf4f88530d0 100644 --- a/compiler/rustc_infer/src/traits/structural_impls.rs +++ b/compiler/rustc_infer/src/traits/structural_impls.rs @@ -47,8 +47,10 @@ impl<'tcx> fmt::Debug for traits::FulfillmentErrorCode<'tcx> { ConstEquateError(ref a, ref b) => { write!(f, "CodeConstEquateError({a:?}, {b:?})") } - Ambiguity { overflow: false } => write!(f, "Ambiguity"), - Ambiguity { overflow: true } => write!(f, "Overflow"), + Ambiguity { overflow: None } => write!(f, "Ambiguity"), + Ambiguity { overflow: Some(suggest_increasing_limit) } => { + write!(f, "Overflow({suggest_increasing_limit})") + } Cycle(ref cycle) => write!(f, "Cycle({cycle:?})"), } } | 
