Skip to content

Commit 5053cce

Browse files
committed
remove it
1 parent f426146 commit 5053cce

36 files changed

+83
-166
lines changed

compiler/rustc_borrowck/src/invalidation.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,6 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
289289
| Rvalue::ShallowInitBox(ref operand, _ /*ty*/) => {
290290
self.consume_operand(location, operand)
291291
}
292-
Rvalue::CopyForDeref(ref place) => {
293-
let op = &Operand::Copy(*place);
294-
self.consume_operand(location, op);
295-
}
296-
297292
Rvalue::Len(place) | Rvalue::Discriminant(place) => {
298293
let af = match *rvalue {
299294
Rvalue::Len(..) => Some(ArtificialField::ArrayLength),

compiler/rustc_borrowck/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,24 +1236,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12361236
| Rvalue::ShallowInitBox(ref operand, _ /*ty*/) => {
12371237
self.consume_operand(location, (operand, span), flow_state)
12381238
}
1239-
Rvalue::CopyForDeref(place) => {
1240-
self.access_place(
1241-
location,
1242-
(place, span),
1243-
(Deep, Read(ReadKind::Copy)),
1244-
LocalMutationIsAllowed::No,
1245-
flow_state,
1246-
);
1247-
1248-
// Finally, check if path was already moved.
1249-
self.check_if_path_or_subpath_is_moved(
1250-
location,
1251-
InitializationRequiringAction::Use,
1252-
(place.as_ref(), span),
1253-
flow_state,
1254-
);
1255-
}
1256-
12571239
Rvalue::Len(place) | Rvalue::Discriminant(place) => {
12581240
let af = match *rvalue {
12591241
Rvalue::Len(..) => Some(ArtificialField::ArrayLength),

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,10 +2283,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22832283
Rvalue::Use(operand) | Rvalue::UnaryOp(_, operand) => {
22842284
self.check_operand(operand, location);
22852285
}
2286-
Rvalue::CopyForDeref(place) => {
2287-
let op = &Operand::Copy(*place);
2288-
self.check_operand(op, location);
2289-
}
22902286

22912287
Rvalue::BinaryOp(_, box (left, right))
22922288
| Rvalue::CheckedBinaryOp(_, box (left, right)) => {
@@ -2317,7 +2313,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
23172313
| Rvalue::BinaryOp(..)
23182314
| Rvalue::CheckedBinaryOp(..)
23192315
| Rvalue::NullaryOp(..)
2320-
| Rvalue::CopyForDeref(..)
23212316
| Rvalue::UnaryOp(..)
23222317
| Rvalue::Discriminant(..) => None,
23232318

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,6 @@ fn codegen_stmt<'tcx>(
503503
let val = codegen_operand(fx, operand);
504504
lval.write_cvalue(fx, val);
505505
}
506-
Rvalue::CopyForDeref(place) => {
507-
let cplace = codegen_place(fx, place);
508-
let val = cplace.to_cvalue(fx);
509-
lval.write_cvalue(fx, val)
510-
}
511506
Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
512507
let place = codegen_place(fx, place);
513508
let ref_ = place.place_ref(fx, lval.layout());

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::traits::*;
88
use crate::MemFlags;
99

1010
use rustc_middle::mir;
11-
use rustc_middle::mir::Operand;
1211
use rustc_middle::ty::cast::{CastTy, IntTy};
1312
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
1413
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt};
@@ -345,10 +344,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
345344
self.codegen_place_to_pointer(bx, place, mk_ref)
346345
}
347346

348-
mir::Rvalue::CopyForDeref(place) => {
349-
let operand = self.codegen_operand(&mut bx, &Operand::Copy(place));
350-
(bx, operand)
351-
}
352347
mir::Rvalue::AddressOf(mutability, place) => {
353348
let mk_ptr = move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| {
354349
tcx.mk_ptr(ty::TypeAndMut { ty, mutbl: mutability })
@@ -703,7 +698,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
703698
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Span) -> bool {
704699
match *rvalue {
705700
mir::Rvalue::Ref(..) |
706-
mir::Rvalue::CopyForDeref(..) |
707701
mir::Rvalue::AddressOf(..) |
708702
mir::Rvalue::Len(..) |
709703
mir::Rvalue::Cast(..) | // (*)

compiler/rustc_const_eval/src/interpret/step.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
172172
self.copy_op(&op, &dest, /*allow_transmute*/ false)?;
173173
}
174174

175-
CopyForDeref(ref place) => {
176-
let op = self.eval_place_to_op(*place, Some(dest.layout))?;
177-
self.copy_op(&op, &dest, /* allow_transmute*/ false)?;
178-
}
179-
180175
BinaryOp(bin_op, box (ref left, ref right)) => {
181176
let layout = binop_left_homogeneous(bin_op).then_some(dest.layout);
182177
let left = self.read_immediate(&self.eval_operand(left, layout)?)?;

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
446446
Rvalue::ThreadLocalRef(_) => self.check_op(ops::ThreadLocalAccess),
447447

448448
Rvalue::Use(_)
449-
| Rvalue::CopyForDeref(..)
450449
| Rvalue::Repeat(..)
451450
| Rvalue::Discriminant(..)
452451
| Rvalue::Len(_)

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ where
260260
in_place::<Q, _>(cx, in_local, place.as_ref())
261261
}
262262

263-
Rvalue::CopyForDeref(place) => in_place::<Q, _>(cx, in_local, place.as_ref()),
264-
265263
Rvalue::Use(operand)
266264
| Rvalue::Repeat(operand, _)
267265
| Rvalue::UnaryOp(_, operand)

compiler/rustc_const_eval/src/transform/check_consts/resolver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ where
199199
mir::Rvalue::Cast(..)
200200
| mir::Rvalue::ShallowInitBox(..)
201201
| mir::Rvalue::Use(..)
202-
| mir::Rvalue::CopyForDeref(..)
203202
| mir::Rvalue::ThreadLocalRef(..)
204203
| mir::Rvalue::Repeat(..)
205204
| mir::Rvalue::Len(..)

compiler/rustc_const_eval/src/transform/promote_consts.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,6 @@ impl<'tcx> Validator<'_, 'tcx> {
494494
Rvalue::Use(operand) | Rvalue::Repeat(operand, _) => {
495495
self.validate_operand(operand)?;
496496
}
497-
Rvalue::CopyForDeref(place) => {
498-
let op = &Operand::Copy(*place);
499-
self.validate_operand(op)?
500-
}
501-
502497
Rvalue::Discriminant(place) | Rvalue::Len(place) => {
503498
self.validate_place(place.as_ref())?
504499
}

0 commit comments

Comments
 (0)