Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
Co-authored-by: lcnr <[email protected]>
  • Loading branch information
compiler-errors and lcnr committed Aug 15, 2023
1 parent 56f5704 commit d2a14df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2a14df

Please sign in to comment.