let trait_ref = cx.tcx.impl_trait_ref(impl_id).expect("must be a trait implementation");
// Only care about `impl PartialEq<Foo> for Foo`
- if trait_ref.input_types()[0] == ty {
+ // For `impl PartialEq<B> for A, input_types is [A, B]
+ if trait_ref.input_types()[1] == ty {
let mess = if peq_is_automatically_derived {
"you are implementing `Hash` explicitly but have derived `PartialEq`"
} else {
use rustc::lint::*;
use rustc::middle::const_val::ConstVal;
use rustc::middle::const_qualif::ConstQualif;
-use rustc::ty::subst::TypeSpace;
use rustc::ty;
use rustc_const_eval::EvalHint::ExprTypeChecked;
use rustc_const_eval::eval_const_expr_partial;
return None;
}
if let ty::TyEnum(_, substs) = ty.sty {
- if let Some(err_ty) = substs.types.opt_get(TypeSpace, 1) {
+ if let Some(err_ty) = substs.types.get(1) {
return Some(err_ty);
}
}
//! This lint is **warn** by default
use rustc::lint::{LintPass, LintArray, LateLintPass, LateContext};
-use rustc::ty::subst::ParamSpace;
use rustc::ty;
use rustc::hir::Expr;
use syntax::ast;
let ty = cx.tcx.expr_ty(expr);
if let ty::TyStruct(_, subst) = ty.sty {
if match_type(cx, ty, &paths::MUTEX) {
- let mutex_param = &subst.types.get(ParamSpace::TypeSpace, 0).sty;
+ let mutex_param = &subst.types[0].sty;
if let Some(atomic_name) = get_atomic_name(mutex_param) {
let msg = format!("Consider using an {} instead of a Mutex here. If you just want the locking \
behaviour and not the internal type, consider using Mutex<()>.",
/// Return the item type of the vector (ie. the `T` in `Vec<T>`).
fn vec_type(ty: ty::Ty) -> ty::Ty {
if let ty::TyStruct(_, substs) = ty.sty {
- substs.types.get(ty::subst::ParamSpace::TypeSpace, 0)
+ substs.types[0]
} else {
panic!("The type of `vec!` is a not a struct?");
}