Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,15 +627,13 @@ impl GotocCtx<'_, '_> {
self,
)
}
ProjectionElem::OpaqueCast(ty) | ProjectionElem::Subtype(ty) => {
ProjectedPlace::try_new(
before.goto_expr.cast_to(self.codegen_ty_stable(*ty)),
TypeOrVariant::Type(*ty),
before.fat_ptr_goto_expr,
before.fat_ptr_mir_typ,
self,
)
}
ProjectionElem::OpaqueCast(ty) => ProjectedPlace::try_new(
before.goto_expr.cast_to(self.codegen_ty_stable(*ty)),
TypeOrVariant::Type(*ty),
before.fat_ptr_goto_expr,
before.fat_ptr_mir_typ,
self,
),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ impl GotocCtx<'_, '_> {
Rvalue::Cast(CastKind::PointerCoercion(k), e, t) => {
self.codegen_pointer_cast(k, e, *t, loc)
}
Rvalue::Cast(CastKind::Transmute, operand, ty) => {
Rvalue::Cast(CastKind::Transmute | CastKind::Subtype, operand, ty) => {
let src_ty = operand.ty(self.current_fn().locals()).unwrap();
// Transmute requires sized types.
let src_sz = LayoutOf::new(src_ty).size_of().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ impl<'tcx> PointsToGraph<'tcx> {
| ProjectionElem::Subslice { .. }
| ProjectionElem::Downcast(..)
| ProjectionElem::OpaqueCast(..)
| ProjectionElem::Subtype(..)
| ProjectionElem::UnwrapUnsafeBinder(..) => {
/* There operations are no-ops w.r.t aliasing since we are tracking it on per-object basis. */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ impl MirVisitor for CheckUninitVisitor {
}
ProjectionElem::Downcast(_) => {}
ProjectionElem::OpaqueCast(_) => {}
ProjectionElem::Subtype(_) => {}
}
}
self.super_place(place, ptx, location)
Expand Down
6 changes: 2 additions & 4 deletions kani-compiler/src/kani_middle/transform/check_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ impl MirVisitor for CheckValueVisitor<'_, '_> {
}
ProjectionElem::Downcast(_) => {}
ProjectionElem::OpaqueCast(_) => {}
ProjectionElem::Subtype(_) => {}
ProjectionElem::Index(_)
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Subslice { .. } => { /* safe */ }
Expand Down Expand Up @@ -619,7 +618,7 @@ impl MirVisitor for CheckValueVisitor<'_, '_> {
})
}
}
CastKind::Transmute => {
CastKind::Transmute | CastKind::Subtype => {
debug!(?dest_ty, "transmute");
// For transmute, we care about the destination type only.
// This could be optimized to only add a check if the requirements of the
Expand Down Expand Up @@ -777,8 +776,7 @@ fn assignment_check_points(
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Subslice { .. }
| ProjectionElem::Downcast(_)
| ProjectionElem::OpaqueCast(_)
| ProjectionElem::Subtype(_) => ty = proj.ty(ty).unwrap(),
| ProjectionElem::OpaqueCast(_) => ty = proj.ty(ty).unwrap(),
};
}
invalid_ranges
Expand Down
1 change: 1 addition & 0 deletions kani-compiler/src/kani_middle/transform/internal_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl RustcInternalMir for CastKind {
CastKind::PtrToPtr => rustc_middle::mir::CastKind::PtrToPtr,
CastKind::FnPtrToPtr => rustc_middle::mir::CastKind::FnPtrToPtr,
CastKind::Transmute => rustc_middle::mir::CastKind::Transmute,
CastKind::Subtype => rustc_middle::mir::CastKind::Subtype,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2025-10-02"
channel = "nightly-2025-10-03"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
1 change: 0 additions & 1 deletion tools/scanner/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ impl MirVisitor for BodyVisitor<'_> {
}
ProjectionElem::Downcast(_) => {}
ProjectionElem::OpaqueCast(_) => {}
ProjectionElem::Subtype(_) => {}
ProjectionElem::Index(_)
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Subslice { .. } => { /* safe */ }
Expand Down
Loading