Skip to content

Commit d2a14df

Browse files
compiler-errorslcnr
andcommitted
nits
Co-authored-by: lcnr <[email protected]>
1 parent 56f5704 commit d2a14df

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4463,7 +4463,10 @@ declare_lint! {
44634463
///
44644464
/// The manual impl of `PartialEq` impl overlaps with the `derive`, since
44654465
/// if we replace `Q = Interval<T>`, then the second impl leads to a cycle:
4466-
/// `PartialOrd for Interval<T> where Interval<T>: Partial`.
4466+
/// `PartialOrd for Interval<T> where Interval<T>: PartialOrd`. This cycle
4467+
/// currently causes the compiler to consider `Interval<T>: PartialOrd` to not
4468+
/// hold, causing the two implementations to be disjoint. This will change in
4469+
/// a future release.
44674470
pub COINDUCTIVE_OVERLAP_IN_COHERENCE,
44684471
Warn,
44694472
"impls that are not considered to overlap may be considered to \

compiler/rustc_trait_selection/src/traits/select/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
741741
return Ok(EvaluatedToOk);
742742
} else {
743743
match self.treat_inductive_cycle {
744-
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig),
744+
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
745745
TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
746746
}
747747
}
@@ -862,7 +862,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
862862
}
863863
ProjectAndUnifyResult::FailedNormalization => Ok(EvaluatedToAmbig),
864864
ProjectAndUnifyResult::Recursive => match self.treat_inductive_cycle {
865-
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToAmbig),
865+
TreatInductiveCycleAs::Ambig => return Ok(EvaluatedToUnknown),
866866
TreatInductiveCycleAs::Recur => return Ok(EvaluatedToRecur),
867867
},
868868
ProjectAndUnifyResult::MismatchedProjectionTypes(_) => Ok(EvaluatedToErr),
@@ -1179,7 +1179,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11791179
} else {
11801180
debug!("evaluate_stack --> recursive, inductive");
11811181
match self.treat_inductive_cycle {
1182-
TreatInductiveCycleAs::Ambig => Some(EvaluatedToAmbig),
1182+
TreatInductiveCycleAs::Ambig => Some(EvaluatedToUnknown),
11831183
TreatInductiveCycleAs::Recur => Some(EvaluatedToRecur),
11841184
}
11851185
}

tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) struct Interval<T>(PhantomData<T>);
99

1010
// This impl overlaps with the `derive` unless we reject the nested
1111
// `Interval<?1>: PartialOrd<Interval<?1>>` candidate which results
12-
// in an inductive cycle right now.
12+
// in a - currently inductive - cycle.
1313
impl<T, Q> PartialEq<Q> for Interval<T>
1414
//~^ ERROR impls that are not considered to overlap may be considered to overlap in the future
1515
//~| WARN this was previously accepted by the compiler but is being phased out

0 commit comments

Comments
 (0)