From e82dcc0bff31caffa77267a50a04bee8eda5a315 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 21 Jul 2023 22:18:28 +0000 Subject: [PATCH 1/2] Actually enable next-coherence --- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/options.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index aedc662b06790..a6b64ef69604f 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -845,7 +845,7 @@ fn test_unstable_options_tracking_hash() { tracked!(thir_unsafeck, true); tracked!(tiny_const_eval_limit, true); tracked!(tls_model, Some(TlsModel::GeneralDynamic)); - tracked!(trait_solver, TraitSolver::NextCoherence); + tracked!(trait_solver, TraitSolver::Next); tracked!(translate_remapped_path_to_local_path, false); tracked!(trap_unreachable, Some(false)); tracked!(treat_err_as_bug, NonZeroUsize::new(1)); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 0c66121c72f89..edd9bf2a60e5a 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -992,7 +992,7 @@ mod parse { Some("next") => *slot = TraitSolver::Next, Some("next-coherence") => *slot = TraitSolver::NextCoherence, // default trait solver is subject to change.. - Some("default") => *slot = TraitSolver::Classic, + Some("default") => *slot = TraitSolver::NextCoherence, _ => return false, } true @@ -1847,8 +1847,8 @@ written to standard error output)"), "for every macro invocation, print its name and arguments (default: no)"), track_diagnostics: bool = (false, parse_bool, [UNTRACKED], "tracks where in rustc a diagnostic was emitted"), - trait_solver: TraitSolver = (TraitSolver::Classic, parse_trait_solver, [TRACKED], - "specify the trait solver mode used by rustc (default: classic)"), + trait_solver: TraitSolver = (TraitSolver::NextCoherence, parse_trait_solver, [TRACKED], + "specify the trait solver mode used by rustc (default: next-coherence)"), // Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved // alongside query results and changes to translation options can affect diagnostics - so // translation options should be tracked. From 6508c9b2e72b7063a7fab84d4531b8c63bb73976 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 21 Jul 2023 22:33:01 +0000 Subject: [PATCH 2/2] hacks --- compiler/rustc_trait_selection/src/solve/eval_ctxt.rs | 1 + compiler/rustc_trait_selection/src/solve/fulfill.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs index 6e0aa08c307bd..11bc6b45f68a1 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs @@ -373,6 +373,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { && has_changed && is_normalizes_to_hack == IsNormalizesToHack::No && !self.search_graph.in_cycle() + && false { debug!("rerunning goal to check result is stable"); let (_orig_values, canonical_goal) = self.canonicalize_goal(goal); diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs index f1d3091225c0f..0da9ee2294d37 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs @@ -89,7 +89,12 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { let mut errors = Vec::new(); for i in 0.. { if !infcx.tcx.recursion_limit().value_within_limit(i) { - unimplemented!("overflowed on pending obligations: {:?}", self.obligations); + let obligation = self.obligations.first().cloned().unwrap(); + return vec![FulfillmentError { + root_obligation: obligation.clone(), + obligation, + code: FulfillmentErrorCode::CodeAmbiguity { overflow: true }, + }]; } let mut has_changed = false;