Skip to content

Commit 6045e60

Browse files
committed
Upgrade toolchain to nightly-2024-04-15
- rust-lang/rust#120131: Add support to `Pat` pattern type - rust-lang/rust#122935: Rename CastKind::PointerWithExposedProvenance - rust-lang/rust#123097: Adapt to changes to local_def_path_hash_to_def_id
1 parent def3a09 commit 6045e60

File tree

7 files changed

+24
-5
lines changed

7 files changed

+24
-5
lines changed

kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs

+5
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ impl<'tcx> GotocCtx<'tcx> {
292292
"element of {parent_ty:?} is not accessed via field projection"
293293
)
294294
}
295+
TyKind::RigidTy(RigidTy::Pat(..)) => {
296+
// See https://github.com/rust-lang/types-team/issues/126
297+
// for what is currently supported.
298+
unreachable!("projection inside a pattern is not supported, only transmute")
299+
}
295300
}
296301
}
297302
// if we fall here, then we are handling an enum

kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ impl<'tcx> GotocCtx<'tcx> {
681681
| CastKind::FnPtrToPtr
682682
| CastKind::PtrToPtr
683683
| CastKind::PointerExposeAddress
684-
| CastKind::PointerFromExposedAddress,
684+
| CastKind::PointerWithExposedProvenance,
685685
e,
686686
t,
687687
) => self.codegen_misc_cast(e, *t),

kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs

+8
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,13 @@ impl<'tcx> GotocCtx<'tcx> {
595595
)
596596
}
597597
}
598+
// This object has the same layout as base. For now, translate this into `(base)`.
599+
// The only difference is the niche.
600+
ty::Pat(base_ty, ..) => {
601+
self.ensure_struct(self.ty_mangled_name(ty), self.ty_pretty_name(ty), |tcx, _| {
602+
tcx.codegen_ty_tuple_like(ty, vec![*base_ty])
603+
})
604+
}
598605
ty::Alias(..) => {
599606
unreachable!("Type should've been normalized already")
600607
}
@@ -995,6 +1002,7 @@ impl<'tcx> GotocCtx<'tcx> {
9951002
| ty::Int(_)
9961003
| ty::RawPtr(_, _)
9971004
| ty::Ref(..)
1005+
| ty::Pat(..)
9981006
| ty::Tuple(_)
9991007
| ty::Uint(_) => self.codegen_ty(pointee_type).to_pointer(),
10001008

kani-compiler/src/kani_middle/stubbing/annotations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn update_stub_mapping(
5656
"duplicate stub mapping: {} mapped to {} and {}",
5757
tcx.def_path_str(orig_id),
5858
tcx.def_path_str(stub_id),
59-
tcx.def_path_str(tcx.def_path_hash_to_def_id(other, &mut || panic!()))
59+
tcx.def_path_str(tcx.def_path_hash_to_def_id(other, &()))
6060
),
6161
);
6262
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn deserialize_mapping(tcx: TyCtxt, val: &str) -> HashMap<DefId, DefId> {
234234
type Item = (u64, u64);
235235
let item_to_def_id = |item: Item| -> DefId {
236236
let hash = DefPathHash(Fingerprint::new(item.0, item.1));
237-
tcx.def_path_hash_to_def_id(hash, &mut || panic!())
237+
tcx.def_path_hash_to_def_id(hash, &())
238238
};
239239
let pairs: Vec<(Item, Item)> = serde_json::from_str(val).unwrap();
240240
let mut m = HashMap::default();

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ impl<'a> MirVisitor for CheckValueVisitor<'a> {
631631
ty: (rvalue.ty(self.locals).unwrap()),
632632
}),
633633
CastKind::PointerExposeAddress
634-
| CastKind::PointerFromExposedAddress
634+
| CastKind::PointerWithExposedProvenance
635635
| CastKind::PointerCoercion(_)
636636
| CastKind::IntToInt
637637
| CastKind::FloatToInt
@@ -898,6 +898,12 @@ fn ty_validity_per_offset(
898898
}
899899
}
900900
}
901+
RigidTy::Pat(base_ty, ..) => {
902+
// This is similar to a structure with one field and with niche defined.
903+
let mut pat_validity = ty_req();
904+
pat_validity.append(&mut ty_validity_per_offset(machine_info, *base_ty, 0)?);
905+
Ok(pat_validity)
906+
}
901907
RigidTy::Tuple(tys) => {
902908
let mut tuple_validity = vec![];
903909
for idx in layout.fields.fields_by_offset_order() {

rust-toolchain.toml

+1-1
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-2024-04-03"
5+
channel = "nightly-2024-04-15"
66
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

0 commit comments

Comments
 (0)