Skip to content

Commit 1c0db81

Browse files
committed
Update toolchain to 1/29
- RValue::RawRef changes, c.f. rust-lang/rust#135748 and rust-lang/rust#136590
1 parent 94ed3f7 commit 1c0db81

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

kani-compiler/src/kani_middle/transform/check_uninit/relevant_instruction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
use crate::kani_middle::transform::body::{InsertPosition, MutableBody, SourceInstruction};
88
use stable_mir::{
9-
mir::{FieldIdx, Mutability, Operand, Place, Rvalue, Statement, StatementKind},
9+
mir::{FieldIdx, Mutability, Operand, Place, RawPtrKind, Rvalue, Statement, StatementKind},
1010
ty::{RigidTy, Ty},
1111
};
1212
use strum_macros::AsRefStr;
@@ -123,7 +123,7 @@ impl MemoryInitOp {
123123
Operand::Copy(place) | Operand::Move(place) => place,
124124
Operand::Constant(_) => unreachable!(),
125125
};
126-
let rvalue = Rvalue::AddressOf(Mutability::Not, place.clone());
126+
let rvalue = Rvalue::AddressOf(RawPtrKind::Const, place.clone());
127127
rvalue.ty(body.locals()).unwrap()
128128
}
129129
MemoryInitOp::Unsupported { .. } | MemoryInitOp::TriviallyUnsafe { .. } => {
@@ -147,7 +147,7 @@ impl MemoryInitOp {
147147
MemoryInitOp::AssignUnion { lvalue, .. } => {
148148
// It does not matter which operand to return for layout generation, since both of
149149
// them have the same pointee type.
150-
let address_of = Rvalue::AddressOf(Mutability::Not, lvalue.clone());
150+
let address_of = Rvalue::AddressOf(RawPtrKind::Const, lvalue.clone());
151151
address_of.ty(body.locals()).unwrap()
152152
}
153153
}
@@ -271,7 +271,7 @@ fn mk_ref(
271271
Operand::Copy(place) | Operand::Move(place) => place,
272272
Operand::Constant(_) => unreachable!(),
273273
};
274-
let rvalue = Rvalue::AddressOf(Mutability::Not, place.clone());
274+
let rvalue = Rvalue::AddressOf(RawPtrKind::Const, place.clone());
275275
let ret_ty = rvalue.ty(body.locals()).unwrap();
276276
let result = body.new_local(ret_ty, span, Mutability::Not);
277277
let stmt = Statement { kind: StatementKind::Assign(Place::from(result), rvalue), span };

kani-compiler/src/kani_middle/transform/check_values.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use stable_mir::mir::mono::Instance;
2828
use stable_mir::mir::visit::{Location, PlaceContext, PlaceRef};
2929
use stable_mir::mir::{
3030
AggregateKind, BasicBlockIdx, BinOp, Body, CastKind, ConstOperand, FieldIdx, Local, LocalDecl,
31-
MirVisitor, Mutability, NonDivergingIntrinsic, Operand, Place, ProjectionElem, Rvalue,
32-
Statement, StatementKind, Terminator, TerminatorKind,
31+
MirVisitor, Mutability, NonDivergingIntrinsic, Operand, Place, ProjectionElem, RawPtrKind,
32+
Rvalue, Statement, StatementKind, Terminator, TerminatorKind,
3333
};
3434
use stable_mir::target::{MachineInfo, MachineSize};
3535
use stable_mir::ty::{AdtKind, IndexedVal, MirConst, RigidTy, Span, Ty, TyKind, UintTy};
@@ -86,7 +86,7 @@ impl ValidValuePass {
8686
match operation {
8787
SourceOp::BytesValidity { ranges, target_ty, rvalue } => {
8888
let value = body.insert_assignment(rvalue, &mut source, InsertPosition::Before);
89-
let rvalue_ptr = Rvalue::AddressOf(Mutability::Not, Place::from(value));
89+
let rvalue_ptr = Rvalue::AddressOf(RawPtrKind::Const, Place::from(value));
9090
for range in ranges {
9191
let result = build_limits(body, &range, rvalue_ptr.clone(), &mut source);
9292
let msg =

kani-compiler/src/kani_middle/transform/internal_mir.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use rustc_smir::rustc_internal::internal;
1313
use stable_mir::mir::{
1414
AggregateKind, AssertMessage, Body, BorrowKind, CastKind, ConstOperand, CopyNonOverlapping,
1515
CoroutineDesugaring, CoroutineKind, CoroutineSource, FakeBorrowKind, FakeReadCause, LocalDecl,
16-
MutBorrowKind, NonDivergingIntrinsic, NullOp, Operand, PointerCoercion, RetagKind, Rvalue,
17-
Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind, UnwindAction,
16+
MutBorrowKind, NonDivergingIntrinsic, NullOp, Operand, PointerCoercion, RawPtrKind, RetagKind,
17+
Rvalue, Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind, UnwindAction,
1818
UserTypeProjection, Variance,
1919
};
2020

@@ -224,9 +224,10 @@ impl RustcInternalMir for Rvalue {
224224

225225
fn internal_mir<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
226226
match self {
227-
Rvalue::AddressOf(mutability, place) => {
228-
rustc_middle::mir::Rvalue::RawPtr(internal(tcx, mutability), internal(tcx, place))
229-
}
227+
Rvalue::AddressOf(raw_ptr_kind, place) => rustc_middle::mir::Rvalue::RawPtr(
228+
raw_ptr_kind.internal_mir(tcx),
229+
internal(tcx, place),
230+
),
230231
Rvalue::Aggregate(aggregate_kind, operands) => rustc_middle::mir::Rvalue::Aggregate(
231232
Box::new(aggregate_kind.internal_mir(tcx)),
232233
rustc_index::IndexVec::from_raw(
@@ -282,6 +283,18 @@ impl RustcInternalMir for Rvalue {
282283
}
283284
}
284285

286+
impl RustcInternalMir for RawPtrKind {
287+
type T<'tcx> = rustc_middle::mir::RawPtrKind;
288+
289+
fn internal_mir<'tcx>(&self, _tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
290+
match self {
291+
RawPtrKind::Mut => rustc_middle::mir::RawPtrKind::Mut,
292+
RawPtrKind::Const => rustc_middle::mir::RawPtrKind::Const,
293+
RawPtrKind::FakeForPtrMetadata => rustc_middle::mir::RawPtrKind::FakeForPtrMetadata,
294+
}
295+
}
296+
}
297+
285298
impl RustcInternalMir for FakeReadCause {
286299
type T<'tcx> = rustc_middle::mir::FakeReadCause;
287300

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
[toolchain]
5-
channel = "nightly-2025-01-28"
5+
channel = "nightly-2025-01-29"
66
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]

0 commit comments

Comments
 (0)