Skip to content

Commit 766f09f

Browse files
committed
Auto merge of rust-lang#7503 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 92ca25b + 80116f9 commit 766f09f

16 files changed

+70
-48
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.55"
3+
version = "0.1.56"
44
authors = ["The Rust Clippy Developers"]
55
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
66
repository = "https://github.com/rust-lang/rust-clippy"

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.1.55"
4+
version = "0.1.56"
55
# end automatic update
66
authors = ["The Rust Clippy Developers"]
77
description = "A bunch of helpful lints to avoid common pitfalls in Rust"

clippy_lints/src/implicit_hasher.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
33

44
use rustc_errors::DiagnosticBuilder;
55
use rustc_hir as hir;
6-
use rustc_hir::intravisit::{walk_body, walk_expr, walk_ty, NestedVisitorMap, Visitor};
6+
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, NestedVisitorMap, Visitor};
77
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
88
use rustc_lint::{LateContext, LateLintPass, LintContext};
99
use rustc_middle::hir::map::Map;
@@ -295,6 +295,14 @@ impl<'a, 'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
295295
walk_ty(self, t);
296296
}
297297

298+
fn visit_infer(&mut self, inf: &'tcx hir::InferArg) {
299+
if let Some(target) = ImplicitHasherType::new(self.cx, &inf.to_ty()) {
300+
self.found.push(target);
301+
}
302+
303+
walk_inf(self, inf);
304+
}
305+
298306
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
299307
NestedVisitorMap::None
300308
}

clippy_lints/src/missing_doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
121121

122122
fn check_crate(&mut self, cx: &LateContext<'tcx>, krate: &'tcx hir::Crate<'_>) {
123123
let attrs = cx.tcx.hir().attrs(hir::CRATE_HIR_ID);
124-
self.check_missing_docs_attrs(cx, attrs, krate.item.inner, "the", "crate");
124+
self.check_missing_docs_attrs(cx, attrs, krate.module().inner, "the", "crate");
125125
}
126126

127127
fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx hir::Item<'_>) {

clippy_lints/src/types/type_complexity.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint;
22
use rustc_hir as hir;
3-
use rustc_hir::intravisit::{walk_ty, NestedVisitorMap, Visitor};
3+
use rustc_hir::intravisit::{walk_inf, walk_ty, NestedVisitorMap, Visitor};
44
use rustc_hir::{GenericParamKind, TyKind};
55
use rustc_lint::LateContext;
66
use rustc_middle::hir::map::Map;
@@ -39,6 +39,11 @@ struct TypeComplexityVisitor {
3939
impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
4040
type Map = Map<'tcx>;
4141

42+
fn visit_infer(&mut self, inf: &'tcx hir::InferArg) {
43+
self.score += 1;
44+
walk_inf(self, inf);
45+
}
46+
4247
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) {
4348
let (add_score, sub_nest) = match ty.kind {
4449
// _, &x and *x have only small overhead; don't mess with nesting level

clippy_lints/src/use_self.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::{
88
self as hir,
99
def::{CtorOf, DefKind, Res},
1010
def_id::LocalDefId,
11-
intravisit::{walk_ty, NestedVisitorMap, Visitor},
11+
intravisit::{walk_inf, walk_ty, NestedVisitorMap, Visitor},
1212
Expr, ExprKind, FnRetTy, FnSig, GenericArg, HirId, Impl, ImplItemKind, Item, ItemKind, Path, QPath, TyKind,
1313
};
1414
use rustc_lint::{LateContext, LateLintPass, LintContext};
@@ -264,6 +264,11 @@ struct SkipTyCollector {
264264
impl<'tcx> Visitor<'tcx> for SkipTyCollector {
265265
type Map = Map<'tcx>;
266266

267+
fn visit_infer(&mut self, inf: &hir::InferArg) {
268+
self.types_to_skip.push(inf.hir_id);
269+
270+
walk_inf(self, inf);
271+
}
267272
fn visit_ty(&mut self, hir_ty: &hir::Ty<'_>) {
268273
self.types_to_skip.push(hir_ty.hir_id);
269274

clippy_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_utils"
3-
version = "0.1.55"
3+
version = "0.1.56"
44
authors = ["The Rust Clippy Developers"]
55
edition = "2018"
66
publish = false

clippy_utils/src/hir_utils.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ impl HirEqInterExpr<'_, '_, '_> {
288288
(GenericArg::Const(l), GenericArg::Const(r)) => self.eq_body(l.value.body, r.value.body),
289289
(GenericArg::Lifetime(l_lt), GenericArg::Lifetime(r_lt)) => Self::eq_lifetime(l_lt, r_lt),
290290
(GenericArg::Type(l_ty), GenericArg::Type(r_ty)) => self.eq_ty(l_ty, r_ty),
291+
(GenericArg::Infer(l_inf), GenericArg::Infer(r_inf)) => self.eq_ty(&l_inf.to_ty(), &r_inf.to_ty()),
291292
_ => false,
292293
}
293294
}
@@ -885,7 +886,11 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
885886

886887
pub fn hash_ty(&mut self, ty: &Ty<'_>) {
887888
std::mem::discriminant(&ty.kind).hash(&mut self.s);
888-
match ty.kind {
889+
self.hash_tykind(&ty.kind);
890+
}
891+
892+
pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
893+
match ty {
889894
TyKind::Slice(ty) => {
890895
self.hash_ty(ty);
891896
},
@@ -898,7 +903,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
898903
mut_ty.mutbl.hash(&mut self.s);
899904
},
900905
TyKind::Rptr(lifetime, ref mut_ty) => {
901-
self.hash_lifetime(lifetime);
906+
self.hash_lifetime(*lifetime);
902907
self.hash_ty(mut_ty.ty);
903908
mut_ty.mutbl.hash(&mut self.s);
904909
},
@@ -918,7 +923,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
918923
bfn.decl.c_variadic.hash(&mut self.s);
919924
},
920925
TyKind::Tup(ty_list) => {
921-
for ty in ty_list {
926+
for ty in *ty_list {
922927
self.hash_ty(ty);
923928
}
924929
},
@@ -927,7 +932,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
927932
self.hash_generic_args(arg_list);
928933
},
929934
TyKind::TraitObject(_, lifetime, _) => {
930-
self.hash_lifetime(lifetime);
935+
self.hash_lifetime(*lifetime);
931936
},
932937
TyKind::Typeof(anon_const) => {
933938
self.hash_body(anon_const.body);
@@ -949,6 +954,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
949954
GenericArg::Lifetime(l) => self.hash_lifetime(l),
950955
GenericArg::Type(ref ty) => self.hash_ty(ty),
951956
GenericArg::Const(ref ca) => self.hash_body(ca.value.body),
957+
GenericArg::Infer(ref inf) => self.hash_ty(&inf.to_ty()),
952958
}
953959
}
954960
}

clippy_utils/src/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
180180
}
181181

182182
// FIXME: Per https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.normalize
183-
// this function can be removed once the `normalizie` method does not panic when normalization does
183+
// this function can be removed once the `normalize` method does not panic when normalization does
184184
// not succeed
185185
/// Checks if `Ty` is normalizable. This function is useful
186186
/// to avoid crashes on `layout_of`.

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-07-19"
2+
channel = "nightly-2021-07-29"
33
components = ["llvm-tools-preview", "rustc-dev", "rust-src"]

0 commit comments

Comments
 (0)