mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
rustup
This commit is contained in:
parent
4c07c0af57
commit
ff919376a6
@ -106,7 +106,8 @@ fn check_hash_peq<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, span: Span, trait_re
|
||||
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 {
|
||||
|
@ -2,7 +2,6 @@ use rustc::hir;
|
||||
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;
|
||||
@ -1085,7 +1084,7 @@ fn get_error_type<'a>(cx: &LateContext, ty: ty::Ty<'a>) -> Option<ty::Ty<'a>> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
//! 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;
|
||||
@ -60,7 +59,7 @@ impl LateLintPass for MutexAtomic {
|
||||
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<()>.",
|
||||
|
@ -89,7 +89,7 @@ fn check_vec_macro(cx: &LateContext, vec_args: &higher::VecArgs, span: Span) {
|
||||
/// 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?");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user