Co-authored-by: lcnr <rust@lcnr.de>
This commit is contained in:
Michael Goulet 2023-07-25 09:19:42 -07:00
parent 56f5704ff8
commit d2a14df70e
3 changed files with 8 additions and 5 deletions

View File

@ -4463,7 +4463,10 @@ declare_lint! {
/// ///
/// The manual impl of `PartialEq` impl overlaps with the `derive`, since /// 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: /// 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, pub COINDUCTIVE_OVERLAP_IN_COHERENCE,
Warn, Warn,
"impls that are not considered to overlap may be considered to \ "impls that are not considered to overlap may be considered to \

View File

@ -741,7 +741,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
return Ok(EvaluatedToOk); return Ok(EvaluatedToOk);
} else { } else {
match self.treat_inductive_cycle { match self.treat_inductive_cycle {
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig), TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur), TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
} }
} }
@ -862,7 +862,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} }
ProjectAndUnifyResult::FailedNormalization => Ok(EvaluatedToAmbig), ProjectAndUnifyResult::FailedNormalization => Ok(EvaluatedToAmbig),
ProjectAndUnifyResult::Recursive => match self.treat_inductive_cycle { ProjectAndUnifyResult::Recursive => match self.treat_inductive_cycle {
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig), TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur), TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
}, },
ProjectAndUnifyResult::MismatchedProjectionTypes(_) => Ok(EvaluatedToErr), ProjectAndUnifyResult::MismatchedProjectionTypes(_) => Ok(EvaluatedToErr),
@ -1179,7 +1179,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} else { } else {
debug!("evaluate_stack --> recursive, inductive"); debug!("evaluate_stack --> recursive, inductive");
match self.treat_inductive_cycle { match self.treat_inductive_cycle {
TreatInductiveCycleAs::Ambig => Some(EvaluatedToAmbig), TreatInductiveCycleAs::Ambig => Some(EvaluatedToUnknown),
TreatInductiveCycleAs::Recur => Some(EvaluatedToRecur), TreatInductiveCycleAs::Recur => Some(EvaluatedToRecur),
} }
} }

View File

@ -9,7 +9,7 @@ pub(crate) struct Interval<T>(PhantomData<T>);
// This impl overlaps with the `derive` unless we reject the nested // This impl overlaps with the `derive` unless we reject the nested
// `Interval<?1>: PartialOrd<Interval<?1>>` candidate which results // `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> impl<T, Q> PartialEq<Q> for Interval<T>
//~^ ERROR impls that are not considered to overlap may be considered to overlap in the future //~^ 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 //~| WARN this was previously accepted by the compiler but is being phased out