Skip to content

Commit 8f6343a

Browse files
committed
miri: remove retag statements, make typed copies retag implicitly instead
1 parent 3f87133 commit 8f6343a

217 files changed

Lines changed: 1026 additions & 2410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ impl<'tcx> rustc_mir_dataflow::Analysis<'tcx> for Borrows<'_, 'tcx> {
578578
mir::StatementKind::FakeRead(..)
579579
| mir::StatementKind::SetDiscriminant { .. }
580580
| mir::StatementKind::StorageLive(..)
581-
| mir::StatementKind::Retag { .. }
582581
| mir::StatementKind::PlaceMention(..)
583582
| mir::StatementKind::AscribeUserType(..)
584583
| mir::StatementKind::Coverage(..)

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4238,7 +4238,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
42384238
// Otherwise, look at other types of assignment.
42394239
let assigned_from = match rvalue {
42404240
Rvalue::Ref(_, _, assigned_from) => assigned_from,
4241-
Rvalue::Use(operand) => match operand {
4241+
Rvalue::Use(operand, _) => match operand {
42424242
Operand::Copy(assigned_from) | Operand::Move(assigned_from) => {
42434243
assigned_from
42444244
}

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
875875
match rvalue {
876876
// If we see a use, we should check whether it is our data, and if so
877877
// update the place that we're looking for to that new place.
878-
Rvalue::Use(operand) => match operand {
878+
Rvalue::Use(operand, _) => match operand {
879879
Operand::Copy(place) | Operand::Move(place) => {
880880
if let Some(from) = place.as_local() {
881881
if from == target {

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
243243
let mut target = place.local_or_deref_local();
244244
for stmt in &self.body[location.block].statements[location.statement_index..] {
245245
debug!("add_moved_or_invoked_closure_note: stmt={:?} target={:?}", stmt, target);
246-
if let StatementKind::Assign(box (into, Rvalue::Use(from))) = &stmt.kind {
246+
if let StatementKind::Assign(box (into, Rvalue::Use(from, _))) = &stmt.kind {
247247
debug!("add_fnonce_closure_note: into={:?} from={:?}", into, from);
248248
match from {
249249
Operand::Copy(place) | Operand::Move(place)

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
120120
// to a user variable is when initializing it.
121121
// If that ever stops being the case, then the ever initialized
122122
// flow could be used.
123-
if let Some(StatementKind::Assign(box (place, Rvalue::Use(Operand::Move(move_from))))) =
123+
if let Some(StatementKind::Assign(box (place, Rvalue::Use(Operand::Move(move_from), _)))) =
124124
self.body.basic_blocks[location.block]
125125
.statements
126126
.get(location.statement_index)

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12821282
if let Some(mir::Statement {
12831283
source_info: _,
12841284
kind:
1285-
mir::StatementKind::Assign(box (_, mir::Rvalue::Use(mir::Operand::Copy(place)))),
1285+
mir::StatementKind::Assign(box (
1286+
_,
1287+
mir::Rvalue::Use(mir::Operand::Copy(place), _),
1288+
)),
12861289
..
12871290
}) = first_assignment_stmt
12881291
{

compiler/rustc_borrowck/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,6 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a,
853853
);
854854
}
855855
StatementKind::Nop
856-
| StatementKind::Retag { .. }
857856
| StatementKind::SetDiscriminant { .. } => {
858857
bug!("Statement not allowed in this MIR phase")
859858
}
@@ -1540,7 +1539,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
15401539

15411540
Rvalue::ThreadLocalRef(_) => {}
15421541

1543-
Rvalue::Use(operand)
1542+
Rvalue::Use(operand, _)
15441543
| Rvalue::Repeat(operand, _)
15451544
| Rvalue::UnaryOp(_ /*un_op*/, operand)
15461545
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {
@@ -1693,7 +1692,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
16931692
StatementKind::Assign(box (
16941693
_,
16951694
Rvalue::Ref(_, _, source)
1696-
| Rvalue::Use(Operand::Copy(source) | Operand::Move(source)),
1695+
| Rvalue::Use(Operand::Copy(source) | Operand::Move(source), _),
16971696
)) => {
16981697
propagate_closure_used_mut_place(self, source);
16991698
}

compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'a, 'tcx> {
8383
}
8484
StatementKind::ConstEvalCounter
8585
| StatementKind::Nop
86-
| StatementKind::Retag { .. }
8786
| StatementKind::BackwardIncompatibleDropHint { .. }
8887
| StatementKind::SetDiscriminant { .. } => {
8988
bug!("Statement not allowed in this MIR phase")
@@ -294,7 +293,7 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
294293

295294
Rvalue::ThreadLocalRef(_) => {}
296295

297-
Rvalue::Use(operand)
296+
Rvalue::Use(operand, _)
298297
| Rvalue::Repeat(operand, _)
299298
| Rvalue::UnaryOp(_ /*un_op*/, operand)
300299
| Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
694694
| StatementKind::FakeRead(..)
695695
| StatementKind::StorageLive(..)
696696
| StatementKind::StorageDead(..)
697-
| StatementKind::Retag { .. }
698697
| StatementKind::Coverage(..)
699698
| StatementKind::ConstEvalCounter
700699
| StatementKind::PlaceMention(..)
@@ -1649,7 +1648,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
16491648
.unwrap();
16501649
}
16511650

1652-
Rvalue::Use(_)
1651+
Rvalue::Use(_, _)
16531652
| Rvalue::UnaryOp(_, _)
16541653
| Rvalue::CopyForDeref(_)
16551654
| Rvalue::BinaryOp(..)
@@ -2210,8 +2209,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22102209
/// rvalue and will be unified with the inferred type.
22112210
fn rvalue_user_ty(&self, rvalue: &Rvalue<'tcx>) -> Option<UserTypeAnnotationIndex> {
22122211
match rvalue {
2213-
Rvalue::Use(_)
2214-
| Rvalue::ThreadLocalRef(_)
2212+
Rvalue::Use(..)
2213+
| Rvalue::ThreadLocalRef(..)
22152214
| Rvalue::Repeat(..)
22162215
| Rvalue::Ref(..)
22172216
| Rvalue::RawPtr(..)

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
620620
let lval = codegen_place(fx, to_place_and_rval.0);
621621
let dest_layout = lval.layout();
622622
match to_place_and_rval.1 {
623-
Rvalue::Use(ref operand) => {
623+
Rvalue::Use(ref operand, _) => {
624624
let val = codegen_operand(fx, operand);
625625
lval.write_cvalue(fx, val);
626626
}
@@ -909,7 +909,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
909909
| StatementKind::ConstEvalCounter
910910
| StatementKind::Nop
911911
| StatementKind::FakeRead(..)
912-
| StatementKind::Retag { .. }
913912
| StatementKind::PlaceMention(..)
914913
| StatementKind::BackwardIncompatibleDropHint { .. }
915914
| StatementKind::AscribeUserType(..) => {}

0 commit comments

Comments
 (0)