Skip to content

Commit

Permalink
Propagate removal of RValue::Len(place) in MIR.
Browse files Browse the repository at this point in the history
Propagated form rust-lang/rust#134330.
`RValue::Len(place)` is still present in StableMIR,
so we translate it back to MIR as `PtrMetadata(Copy(place))`.
  • Loading branch information
Remi Delmas committed Jan 6, 2025
1 parent de97904 commit 05e6550
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ impl<'tcx> PointsToAnalysis<'_, 'tcx> {
// The same story from BinOp applies here, too. Need to track those things.
self.successors_for_operand(state, operand)
}
Rvalue::Len(..) | Rvalue::NullaryOp(..) | Rvalue::Discriminant(..) => {
Rvalue::NullaryOp(..) | Rvalue::Discriminant(..) => {
// All of those should yield a constant.
HashSet::new()
}
Expand Down
5 changes: 4 additions & 1 deletion kani-compiler/src/kani_middle/transform/internal_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ impl RustcInternalMir for Rvalue {
Rvalue::Discriminant(place) => {
rustc_middle::mir::Rvalue::Discriminant(internal(tcx, place))
}
Rvalue::Len(place) => rustc_middle::mir::Rvalue::Len(internal(tcx, place)),
Rvalue::Len(place) => rustc_middle::mir::Rvalue::UnaryOp(
rustc_middle::mir::UnOp::PtrMetadata,
rustc_middle::mir::Operand::Copy(internal(tcx, place)),
),
Rvalue::Ref(region, borrow_kind, place) => rustc_middle::mir::Rvalue::Ref(
internal(tcx, region),
borrow_kind.internal_mir(tcx),
Expand Down

0 comments on commit 05e6550

Please sign in to comment.