Skip to content

Commit

Permalink
Auto merge of rust-lang#8057 - flip1995:rustup, r=flip1995
Browse files Browse the repository at this point in the history
Rustup

r? `@ghost`

changelog: none
  • Loading branch information
bors committed Dec 2, 2021
2 parents 8ad56c8 + ec57cc1 commit 392b0c5
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.58"
version = "0.1.59"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.58"
version = "0.1.59"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
8 changes: 1 addition & 7 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use clippy_utils::paths;
use clippy_utils::ty::{implements_trait, is_copy};
use clippy_utils::{get_trait_def_id, is_automatically_derived, is_lint_allowed, match_def_path};
use if_chain::if_chain;
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{walk_expr, walk_fn, walk_item, FnKind, NestedVisitorMap, Visitor};
use rustc_hir::{
BlockCheckMode, BodyId, Expr, ExprKind, FnDecl, HirId, Impl, Item, ItemKind, TraitRef, UnsafeSource, Unsafety,
Expand Down Expand Up @@ -347,11 +346,6 @@ fn check_unsafe_derive_deserialize<'tcx>(
trait_ref: &TraitRef<'_>,
ty: Ty<'tcx>,
) {
fn item_from_def_id<'tcx>(cx: &LateContext<'tcx>, def_id: DefId) -> &'tcx Item<'tcx> {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
cx.tcx.hir().expect_item(hir_id)
}

fn has_unsafe<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>) -> bool {
let mut visitor = UnsafeVisitor { cx, has_unsafe: false };
walk_item(&mut visitor, item);
Expand All @@ -367,7 +361,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
if !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
if cx.tcx.inherent_impls(def.did)
.iter()
.map(|imp_did| item_from_def_id(cx, *imp_did))
.map(|imp_did| cx.tcx.hir().expect_item(imp_did.expect_local()))
.any(|imp| has_unsafe(cx, imp));
then {
span_lint_and_help(
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
return;
}
let name = impl_item.ident.name.as_str();
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
let item = cx.tcx.hir().expect_item(parent);
let self_ty = cx.tcx.type_of(item.def_id);

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/non_copy_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {

fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
if let ImplItemKind::Const(hir_ty, body_id) = &impl_item.kind {
let item_hir_id = cx.tcx.hir().get_parent_node(impl_item.hir_id());
let item = cx.tcx.hir().expect_item(item_hir_id);
let item_def_id = cx.tcx.hir().get_parent_did(impl_item.hir_id());
let item = cx.tcx.hir().expect_item(item_def_id);

match &item.kind {
ItemKind::Impl(Impl {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/self_named_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
_ => return,
}

let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
let item = cx.tcx.hir().expect_item(parent);
let self_ty = cx.tcx.type_of(item.def_id);
let ret_ty = return_ty(cx, impl_item.hir_id());
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unused_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedSelf {
if impl_item.span.from_expansion() {
return;
}
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
let parent = cx.tcx.hir().get_parent_did(impl_item.hir_id());
let parent_item = cx.tcx.hir().expect_item(parent);
let assoc_item = cx.tcx.associated_item(impl_item.def_id);
if_chain! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_utils"
version = "0.1.58"
version = "0.1.59"
edition = "2021"
publish = false

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2021-11-23"
channel = "nightly-2021-12-02"
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
3 changes: 3 additions & 0 deletions tests/ui/crashes/ice-6250.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ LL | | }
error[E0308]: mismatched types
--> $DIR/ice-6250.rs:12:14
|
LL | for reference in vec![1, 2, 3] {
| --------- expected due to the type of this binding
...
LL | Some(reference) = cache.data.get(key) {
| ^^^^^^^^^ expected integer, found `&i32`
|
Expand Down

0 comments on commit 392b0c5

Please sign in to comment.