diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2025-04-21 15:55:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-21 15:55:58 +0000 |
| commit | f79eef91df057d17dd8123f2e8f61232762bdbd7 (patch) | |
| tree | e5c306d9e95ebb8c3f91cf911ed2b7f04eb6e79e /compiler/rustc_trait_selection/src | |
| parent | 24bd5649b1d7fd3c0467703f249ac05fb0991567 (diff) | |
| parent | 47911eb677a29006d243a0b6bf17f26486191ead (diff) | |
Rollup merge of #140021 - compiler-errors:no-deep-norm-ice, r=lcnr
Don't ICE on pending obligations from deep normalization in a loop See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`. Fixes https://github.com/rust-lang/rust/issues/133868 r? lcnr
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/normalize.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs index 4ac45172a0e..7551ac5aa97 100644 --- a/compiler/rustc_trait_selection/src/traits/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/normalize.rs @@ -77,7 +77,15 @@ impl<'tcx> At<'_, 'tcx> { .into_value_registering_obligations(self.infcx, &mut *fulfill_cx); let errors = fulfill_cx.select_all_or_error(self.infcx); let value = self.infcx.resolve_vars_if_possible(value); - if errors.is_empty() { Ok(value) } else { Err(errors) } + if errors.is_empty() { + Ok(value) + } else { + // Drop pending obligations, since deep normalization may happen + // in a loop and we don't want to trigger the assertion on the next + // iteration due to pending ambiguous obligations we've left over. + let _ = fulfill_cx.collect_remaining_errors(self.infcx); + Err(errors) + } } } } |
