Rustup to 1.9.0-nightly (7979dd608 2016-04-07)

This commit is contained in:
mcarton 2016-04-08 17:31:47 +02:00
parent 76a831c60f
commit 532446d3f8

View file

@ -1,7 +1,6 @@
use rustc::lint::*;
use rustc::ty::subst::Subst;
use rustc::ty::TypeVariants;
use rustc::ty::fast_reject::simplify_type;
use rustc::ty;
use rustc::hir::*;
use syntax::ast::{Attribute, MetaItemKind};
@ -87,22 +86,15 @@ impl LateLintPass for Derive {
}
/// Implementation of the `DERIVE_HASH_XOR_EQ` lint.
fn check_hash_peq(cx: &LateContext, span: Span, trait_ref: &TraitRef, ty: ty::Ty, hash_is_automatically_derived: bool) {
fn check_hash_peq<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>, hash_is_automatically_derived: bool) {
if_let_chain! {[
match_path(&trait_ref.path, &HASH_PATH),
let Some(peq_trait_def_id) = cx.tcx.lang_items.eq_trait()
], {
let peq_trait_def = cx.tcx.lookup_trait_def(peq_trait_def_id);
cx.tcx.populate_implementations_for_trait_if_necessary(peq_trait_def.trait_ref.def_id);
let peq_impls = peq_trait_def.borrow_impl_lists(cx.tcx).1;
// Look for the PartialEq implementations for `ty`
if_let_chain! {[
let Some(simpl_ty) = simplify_type(cx.tcx, ty, false),
let Some(impl_ids) = peq_impls.get(&simpl_ty)
], {
for &impl_id in impl_ids {
peq_trait_def.for_each_relevant_impl(&cx.tcx, ty, |impl_id| {
let peq_is_automatically_derived = cx.tcx.get_attrs(impl_id).iter().any(is_automatically_derived);
if peq_is_automatically_derived == hash_is_automatically_derived {
@ -131,8 +123,7 @@ fn check_hash_peq(cx: &LateContext, span: Span, trait_ref: &TraitRef, ty: ty::Ty
}
});
}
}
}}
});
}}
}