Skip to content

Commit 8dfabdf

Browse files
committedMar 1, 2019
Auto merge of #3823 - spastorino:place_base, r=flip1995
Place::Local(x) is now Place::Base(PlaceBase::Local(x)) We need to merge this after the beta cut for this rust-lang/rust#58631 to work. /cc @oli-obk
2 parents 9f20556 + 77a67c9 commit 8dfabdf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎clippy_lints/src/redundant_clone.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
143143
let pred_arg = if_chain! {
144144
if let Some((pred_fn_def_id, pred_arg, pred_arg_ty, Some(res))) =
145145
is_call_with_ref_arg(cx, mir, &pred_terminator.kind);
146-
if *res == mir::Place::Local(cloned);
146+
if *res == mir::Place::Base(mir::PlaceBase::Local(cloned));
147147
if match_def_path(cx.tcx, pred_fn_def_id, &paths::DEREF_TRAIT_METHOD);
148148
if match_type(cx, pred_arg_ty, &paths::PATH_BUF)
149149
|| match_type(cx, pred_arg_ty, &paths::OS_STRING);
@@ -229,7 +229,7 @@ fn is_call_with_ref_arg<'tcx>(
229229
if_chain! {
230230
if let TerminatorKind::Call { func, args, destination, .. } = kind;
231231
if args.len() == 1;
232-
if let mir::Operand::Move(mir::Place::Local(local)) = &args[0];
232+
if let mir::Operand::Move(mir::Place::Base(mir::PlaceBase::Local(local))) = &args[0];
233233
if let ty::FnDef(def_id, _) = func.ty(&*mir, cx.tcx).sty;
234234
if let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].ty(&*mir, cx.tcx));
235235
if !is_copy(cx, inner_ty);
@@ -255,7 +255,7 @@ fn find_stmt_assigns_to<'a, 'tcx: 'a>(
255255
stmts
256256
.rev()
257257
.find_map(|stmt| {
258-
if let mir::StatementKind::Assign(mir::Place::Local(local), v) = &stmt.kind {
258+
if let mir::StatementKind::Assign(mir::Place::Base(mir::PlaceBase::Local(local)), v) = &stmt.kind {
259259
if *local == to {
260260
return Some(v);
261261
}
@@ -285,6 +285,7 @@ fn base_local_and_movability<'tcx>(
285285
mut place: &mir::Place<'tcx>,
286286
) -> Option<(mir::Local, CannotMoveOut)> {
287287
use rustc::mir::Place::*;
288+
use rustc::mir::PlaceBase;
288289

289290
// Dereference. You cannot move things out from a borrowed value.
290291
let mut deref = false;
@@ -293,7 +294,7 @@ fn base_local_and_movability<'tcx>(
293294

294295
loop {
295296
match place {
296-
Local(local) => return Some((*local, deref || field)),
297+
Base(PlaceBase::Local(local)) => return Some((*local, deref || field)),
297298
Projection(proj) => {
298299
place = &proj.base;
299300
deref = deref || matches!(proj.elem, mir::ProjectionElem::Deref);

0 commit comments

Comments
 (0)
Please sign in to comment.