about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-07-25 09:19:42 -0700
committerMichael Goulet <michael@errs.io>2023-08-15 03:40:19 +0000
commitd2a14df70e359660c86e79f20aaa5df1e71f4bb1 (patch)
tree5567e088cbf21c5577b50ce14d386d7796b96bb5
parent56f5704ff843256912260678433778f27bb6f6c8 (diff)
downloadrust-d2a14df70e359660c86e79f20aaa5df1e71f4bb1.tar.gz
rust-d2a14df70e359660c86e79f20aaa5df1e71f4bb1.zip
nits
Co-authored-by: lcnr <rust@lcnr.de>
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs6
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs2
3 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index b3e5fee4185..815eadbcb91 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -4463,7 +4463,10 @@ declare_lint! {
     ///
     /// The manual impl of `PartialEq` impl overlaps with the `derive`, since
     /// if we replace `Q = Interval<T>`, then the second impl leads to a cycle:
-    /// `PartialOrd for Interval<T> where Interval<T>: Partial`.
+    /// `PartialOrd for Interval<T> where Interval<T>: PartialOrd`. This cycle
+    /// currently causes the compiler to consider `Interval<T>: PartialOrd` to not
+    /// hold, causing the two implementations to be disjoint. This will change in
+    /// a future release.
     pub COINDUCTIVE_OVERLAP_IN_COHERENCE,
     Warn,
     "impls that are not considered to overlap may be considered to \
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 0a8aa1bee26..85f4df28bdf 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -741,7 +741,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                                 return Ok(EvaluatedToOk);
                             } else {
                                 match self.treat_inductive_cycle {
-                                    TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig),
+                                    TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
                                     TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
                                 }
                             }
@@ -862,7 +862,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                         }
                         ProjectAndUnifyResult::FailedNormalization => Ok(EvaluatedToAmbig),
                         ProjectAndUnifyResult::Recursive => match self.treat_inductive_cycle {
-                            TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig),
+                            TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
                             TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
                         },
                         ProjectAndUnifyResult::MismatchedProjectionTypes(_) => Ok(EvaluatedToErr),
@@ -1179,7 +1179,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             } else {
                 debug!("evaluate_stack --> recursive, inductive");
                 match self.treat_inductive_cycle {
-                    TreatInductiveCycleAs::Ambig => Some(EvaluatedToAmbig),
+                    TreatInductiveCycleAs::Ambig => Some(EvaluatedToUnknown),
                     TreatInductiveCycleAs::Recur => Some(EvaluatedToRecur),
                 }
             }
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs
index 80530acd2aa..268fe56368c 100644
--- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs
@@ -9,7 +9,7 @@ pub(crate) struct Interval<T>(PhantomData<T>);
 
 // This impl overlaps with the `derive` unless we reject the nested
 // `Interval<?1>: PartialOrd<Interval<?1>>` candidate which results
-// in an inductive cycle right now.
+// in a - currently inductive - cycle.
 impl<T, Q> PartialEq<Q> for Interval<T>
 //~^ ERROR impls that are not considered to overlap may be considered to overlap in the future
 //~| WARN this was previously accepted by the compiler but is being phased out