mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-21 12:13:12 +00:00
s/pord/partial_ord/ to fix dogfood failure
This commit is contained in:
parent
668b7474b4
commit
ca03f2b650
@ -173,7 +173,7 @@ impl<'tcx> LateLintPass<'tcx> for Derive {
|
|||||||
let is_automatically_derived = is_automatically_derived(&*item.attrs);
|
let is_automatically_derived = is_automatically_derived(&*item.attrs);
|
||||||
|
|
||||||
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
|
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
|
||||||
check_ord_pord(cx, item.span, trait_ref, ty, is_automatically_derived);
|
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);
|
||||||
|
|
||||||
if is_automatically_derived {
|
if is_automatically_derived {
|
||||||
check_unsafe_derive_deserialize(cx, item, trait_ref, ty);
|
check_unsafe_derive_deserialize(cx, item, trait_ref, ty);
|
||||||
@ -239,7 +239,7 @@ fn check_hash_peq<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of the `DERIVE_ORD_XOR_PARTIAL_ORD` lint.
|
/// Implementation of the `DERIVE_ORD_XOR_PARTIAL_ORD` lint.
|
||||||
fn check_ord_pord<'tcx>(
|
fn check_ord_partial_ord<'tcx>(
|
||||||
cx: &LateContext<'tcx>,
|
cx: &LateContext<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
trait_ref: &TraitRef<'_>,
|
trait_ref: &TraitRef<'_>,
|
||||||
@ -248,15 +248,15 @@ fn check_ord_pord<'tcx>(
|
|||||||
) {
|
) {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let Some(ord_trait_def_id) = get_trait_def_id(cx, &paths::ORD);
|
if let Some(ord_trait_def_id) = get_trait_def_id(cx, &paths::ORD);
|
||||||
if let Some(pord_trait_def_id) = cx.tcx.lang_items().partial_ord_trait();
|
if let Some(partial_ord_trait_def_id) = cx.tcx.lang_items().partial_ord_trait();
|
||||||
if let Some(def_id) = &trait_ref.trait_def_id();
|
if let Some(def_id) = &trait_ref.trait_def_id();
|
||||||
if *def_id == ord_trait_def_id;
|
if *def_id == ord_trait_def_id;
|
||||||
then {
|
then {
|
||||||
// Look for the PartialOrd implementations for `ty`
|
// Look for the PartialOrd implementations for `ty`
|
||||||
cx.tcx.for_each_relevant_impl(pord_trait_def_id, ty, |impl_id| {
|
cx.tcx.for_each_relevant_impl(partial_ord_trait_def_id, ty, |impl_id| {
|
||||||
let pord_is_automatically_derived = is_automatically_derived(&cx.tcx.get_attrs(impl_id));
|
let partial_ord_is_automatically_derived = is_automatically_derived(&cx.tcx.get_attrs(impl_id));
|
||||||
|
|
||||||
if pord_is_automatically_derived == ord_is_automatically_derived {
|
if partial_ord_is_automatically_derived == ord_is_automatically_derived {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ fn check_ord_pord<'tcx>(
|
|||||||
// Only care about `impl PartialOrd<Foo> for Foo`
|
// Only care about `impl PartialOrd<Foo> for Foo`
|
||||||
// For `impl PartialOrd<B> for A, input_types is [A, B]
|
// For `impl PartialOrd<B> for A, input_types is [A, B]
|
||||||
if trait_ref.substs.type_at(1) == ty {
|
if trait_ref.substs.type_at(1) == ty {
|
||||||
let mess = if pord_is_automatically_derived {
|
let mess = if partial_ord_is_automatically_derived {
|
||||||
"you are implementing `Ord` explicitly but have derived `PartialOrd`"
|
"you are implementing `Ord` explicitly but have derived `PartialOrd`"
|
||||||
} else {
|
} else {
|
||||||
"you are deriving `Ord` but have implemented `PartialOrd` explicitly"
|
"you are deriving `Ord` but have implemented `PartialOrd` explicitly"
|
||||||
|
Loading…
Reference in New Issue
Block a user