From 286b39d2e5ea5dd28e8c2d783fd5d528cf8c2a12 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Mon, 2 Dec 2019 20:39:40 +0100 Subject: [PATCH 1/2] Rustup to rust-lang/rust#64736 --- clippy_lints/src/redundant_clone.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 8ad8e45a2dbf..ca0d6ace03f5 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -81,6 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { ) { let def_id = cx.tcx.hir().body_owner_def_id(body.id()); let mir = cx.tcx.optimized_mir(def_id); + let mir_read_only = mir.unwrap_read_only(); let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); let maybe_storage_live_result = do_dataflow( @@ -94,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { ); let mut possible_borrower = { let mut vis = PossibleBorrowerVisitor::new(cx, mir); - vis.visit_body(mir); + vis.visit_body(mir_read_only); vis.into_map(cx, maybe_storage_live_result) }; @@ -146,7 +147,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { // `arg` is a reference as it is `.deref()`ed in the previous block. // Look into the predecessor block and find out the source of deref. - let ps = mir.predecessors_for(bb); + let ps = mir_read_only.predecessors_for(bb); if ps.len() != 1 { continue; } From 511deceb36e5d14f3b3e2c7b8a003f34c9a487d8 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Mon, 2 Dec 2019 20:42:39 +0100 Subject: [PATCH 2/2] Normalize custom ICE test Fixes #4872 --- tests/ui/custom_ice_message.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ui/custom_ice_message.rs b/tests/ui/custom_ice_message.rs index 2f58fbce30bf..5b30c9d5721c 100644 --- a/tests/ui/custom_ice_message.rs +++ b/tests/ui/custom_ice_message.rs @@ -1,6 +1,7 @@ // rustc-env:RUST_BACKTRACE=0 // normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo" // normalize-stderr-test: "internal_lints.rs:\d*:\d*" -> "internal_lints.rs" +// normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints" #![deny(clippy::internal)]