diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2024-04-04 21:16:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-04 21:16:58 -0400 |
| commit | e01d3e0824cd24dc02c0b22db2fa0d4677f1a0c3 (patch) | |
| tree | 6f21c67c8c732f18bda866d4da6d2a79d0b6ebe9 | |
| parent | 58eb6e580316b01cfbd68d9d02c98e1e68daf249 (diff) | |
| parent | 9444ca354a5ed82ab7c8b264117c9a9436948ce9 (diff) | |
| download | rust-e01d3e0824cd24dc02c0b22db2fa0d4677f1a0c3.tar.gz rust-e01d3e0824cd24dc02c0b22db2fa0d4677f1a0c3.zip | |
Rollup merge of #123477 - lcnr:forced_ambig-no-ice, r=compiler-errors
do not ICE in `fn forced_ambiguity` if we get an error see the comment. currently causing an ICE in typenum which we've been unable to minimize. r? `@compiler-errors`
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/assembly/mod.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs index 5e580df01cb..35f7d1d7151 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs @@ -312,11 +312,18 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { fn forced_ambiguity(&mut self, cause: MaybeCause) -> Vec<Candidate<'tcx>> { let source = CandidateSource::BuiltinImpl(BuiltinImplSource::Misc); let certainty = Certainty::Maybe(cause); - let result = self.evaluate_added_goals_and_make_canonical_response(certainty).unwrap(); + // This may fail if `try_evaluate_added_goals` overflows because it + // fails to reach a fixpoint but ends up getting an error after + // running for some additional step. + // + // FIXME: Add a test for this. It seems to be necessary for typenum but + // is incredibly hard to minimize as it may rely on being inside of a + // trait solver cycle. + let result = self.evaluate_added_goals_and_make_canonical_response(certainty); let mut dummy_probe = self.inspect.new_probe(); - dummy_probe.probe_kind(ProbeKind::TraitCandidate { source, result: Ok(result) }); + dummy_probe.probe_kind(ProbeKind::TraitCandidate { source, result }); self.inspect.finish_probe(dummy_probe); - vec![Candidate { source, result }] + if let Ok(result) = result { vec![Candidate { source, result }] } else { vec![] } } #[instrument(level = "debug", skip_all)] |
