diff options
| author | bors <bors@rust-lang.org> | 2022-08-22 08:32:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-22 08:32:41 +0000 |
| commit | ee8c31e64d229cac4eba6d8f03bb70e16f34a14b (patch) | |
| tree | 0c9ff6127f19cacf68070cea3a978ca3a01d9c4d /compiler/rustc_trait_selection/src/traits | |
| parent | a9bb589cd678e034d194193fa892942315b10e2a (diff) | |
| parent | 88e39b2c2e875d78f8c04fe8c6a52a6a48632af5 (diff) | |
| download | rust-ee8c31e64d229cac4eba6d8f03bb70e16f34a14b.tar.gz rust-ee8c31e64d229cac4eba6d8f03bb70e16f34a14b.zip | |
Auto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #93162 (Std module docs improvements) - #99386 (Add tests that check `Vec::retain` predicate execution order.) - #99915 (Recover keywords in trait bounds) - #100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)) - #100757 (Catch overflow early) Failed merges: - #99917 (Move Error trait into core) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 715b9749268..aeaccffd5f5 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -554,6 +554,18 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> { .flatten() .unwrap_or_else(|| ty::Term::Ty(ty.super_fold_with(self))) }; + // For cases like #95134 we would like to catch overflows early + // otherwise they slip away away and cause ICE. + let recursion_limit = self.tcx().recursion_limit(); + if !recursion_limit.value_within_limit(self.depth) { + let obligation = Obligation::with_depth( + self.cause.clone(), + recursion_limit.0, + self.param_env, + ty, + ); + self.selcx.infcx().report_overflow_error(&obligation, true); + } debug!( ?self.depth, ?ty, |
