about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-14 15:29:38 +0000
committerbors <bors@rust-lang.org>2023-12-14 15:29:38 +0000
commit2ecba0fa00b75e7291978c50bece407f17296f45 (patch)
tree4e9bb894e29d88bdbab3ae09a717869ae5f1c17f /compiler/rustc_trait_selection/src/solve
parent529047cfc3f4f7b3ea5aaac054408f368d153727 (diff)
parentfa03289ddfc15d4582a866e66c9003fc6fc11a9f (diff)
downloadrust-2ecba0fa00b75e7291978c50bece407f17296f45.tar.gz
rust-2ecba0fa00b75e7291978c50bece407f17296f45.zip
Auto merge of #118937 - lcnr:rename-solver-flag, r=compiler-errors
`-Ztrait-solver=next` to `-Znext-solver`

renames the feature flag to enable the new trait solver.

still want some feedback before merging: https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/renaming.20the.20feature.20flag.20to.20.60-Znew-solver.60.

The idea is to make it easier to add another option, e.g. to enable the solver in wfcheck or to optionally change its behavior to our new coinduction approach.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs11
-rw-r--r--compiler/rustc_trait_selection/src/solve/inspect/build.rs2
-rw-r--r--compiler/rustc_trait_selection/src/solve/mod.rs5
-rw-r--r--compiler/rustc_trait_selection/src/solve/search_graph.rs6
-rw-r--r--compiler/rustc_trait_selection/src/solve/trait_goals.rs2
5 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
index b3e7a63c972..cafb858794a 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
@@ -200,9 +200,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
         let result = f(&mut ecx);
 
         let tree = ecx.inspect.finalize();
-        if let (Some(tree), DumpSolverProofTree::Always) =
-            (&tree, infcx.tcx.sess.opts.unstable_opts.dump_solver_proof_tree)
-        {
+        if let (Some(tree), DumpSolverProofTree::Always) = (
+            &tree,
+            infcx.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default(),
+        ) {
             let mut lock = std::io::stdout().lock();
             let _ = lock.write_fmt(format_args!("{tree:?}\n"));
             let _ = lock.flush();
@@ -377,7 +378,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
         //
         // This assert was removed as it did not hold for goals constraining
         // an inference variable to a recursive alias, e.g. in
-        // tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs.
+        // tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs.
         //
         // Once we have decided on how to handle trait-system-refactor-initiative#75,
         // we should re-add an assert here.
@@ -421,7 +422,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
                     self.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })
                 }
                 ty::PredicateKind::ConstEquate(_, _) => {
-                    bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active")
+                    bug!("ConstEquate should not be emitted when `-Znext-solver` is active")
                 }
                 ty::PredicateKind::NormalizesTo(predicate) => {
                     self.compute_normalizes_to_goal(Goal { param_env, predicate })
diff --git a/compiler/rustc_trait_selection/src/solve/inspect/build.rs b/compiler/rustc_trait_selection/src/solve/inspect/build.rs
index 0d46df44c91..c857aae572d 100644
--- a/compiler/rustc_trait_selection/src/solve/inspect/build.rs
+++ b/compiler/rustc_trait_selection/src/solve/inspect/build.rs
@@ -265,7 +265,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
             GenerateProofTree::Never => ProofTreeBuilder::new_noop(),
             GenerateProofTree::IfEnabled => {
                 let opts = &tcx.sess.opts.unstable_opts;
-                match opts.dump_solver_proof_tree {
+                match opts.next_solver.map(|c| c.dump_tree).unwrap_or_default() {
                     DumpSolverProofTree::Always => ProofTreeBuilder::new_root(),
                     // `OnError` is handled by reevaluating goals in error
                     // reporting with `GenerateProofTree::Yes`.
diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs
index f45473e06dc..1e58106e353 100644
--- a/compiler/rustc_trait_selection/src/solve/mod.rs
+++ b/compiler/rustc_trait_selection/src/solve/mod.rs
@@ -1,7 +1,6 @@
 //! The next-generation trait solver, currently still WIP.
 //!
-//! As a user of rust, you can use `-Ztrait-solver=next` or `next-coherence`
-//! to enable the new trait solver always, or just within coherence, respectively.
+//! As a user of rust, you can use `-Znext-solver` to enable the new trait solver.
 //!
 //! As a developer of rustc, you shouldn't be using the new trait
 //! solver without asking the trait-system-refactor-initiative, but it can
@@ -248,7 +247,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
             return None;
         }
 
-        // FIXME(-Ztrait-solver=next): We should instead try to find a `Certainty::Yes` response with
+        // FIXME(-Znext-solver): We should instead try to find a `Certainty::Yes` response with
         // a subset of the constraints that all the other responses have.
         let one = responses[0];
         if responses[1..].iter().all(|&resp| resp == one) {
diff --git a/compiler/rustc_trait_selection/src/solve/search_graph.rs b/compiler/rustc_trait_selection/src/solve/search_graph.rs
index 71adebffc15..2a08b80e02a 100644
--- a/compiler/rustc_trait_selection/src/solve/search_graph.rs
+++ b/compiler/rustc_trait_selection/src/solve/search_graph.rs
@@ -38,7 +38,7 @@ struct StackEntry<'tcx> {
     /// If we were to use that result when later trying to prove another cycle
     /// participant, we can end up with unstable query results.
     ///
-    /// See tests/ui/new-solver/coinduction/incompleteness-unstable-result.rs for
+    /// See tests/ui/next-solver/coinduction/incompleteness-unstable-result.rs for
     /// an example of where this is needed.
     cycle_participants: FxHashSet<CanonicalInput<'tcx>>,
 }
@@ -237,7 +237,7 @@ impl<'tcx> SearchGraph<'tcx> {
                     // in unstable results due to incompleteness.
                     //
                     // However, a test for this would be an even more complex version of
-                    // tests/ui/traits/new-solver/coinduction/incompleteness-unstable-result.rs.
+                    // tests/ui/traits/next-solver/coinduction/incompleteness-unstable-result.rs.
                     // I did not bother to write such a test and we have no regression test
                     // for this. It would be good to have such a test :)
                     #[allow(rustc::potential_query_instability)]
@@ -248,7 +248,7 @@ impl<'tcx> SearchGraph<'tcx> {
                 // until we reach a fixpoint. It is not enough to simply retry the
                 // `root` goal of this cycle.
                 //
-                // See tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
+                // See tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
                 // for an example.
                 self.stack[stack_depth].has_been_used = true;
                 return if let Some(result) = self.stack[stack_depth].provisional_result {
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
index 5807f7c6153..9536fde7c93 100644
--- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs
+++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
@@ -445,7 +445,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
             return Err(NoSolution);
         }
 
-        // FIXME(-Ztrait-solver=next): Implement this when we get const working in the new solver
+        // FIXME(-Znext-solver): Implement this when we get const working in the new solver
 
         // `Destruct` is automatically implemented for every type in
         // non-const environments.