Skip to content

Commit 688aa59

Browse files
authored
Upgrade Rust toolchain to nightly-2023-02-03 (rust-lang#2291)
1 parent 4b925fd commit 688aa59

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,17 +783,20 @@ impl<'tcx> GotocCtx<'tcx> {
783783
);
784784
}
785785

786+
let param_env_and_layout = ty::ParamEnv::reveal_all().and(layout);
787+
786788
// Then we check if the type allows "raw" initialization for the cases
787789
// where memory is zero-initialized or entirely uninitialized
788-
if intrinsic == "assert_zero_valid" && !self.tcx.permits_zero_init(layout) {
790+
if intrinsic == "assert_zero_valid" && !self.tcx.permits_zero_init(param_env_and_layout) {
789791
return self.codegen_fatal_error(
790792
PropertyClass::SafetyCheck,
791793
&format!("attempted to zero-initialize type `{ty}`, which is invalid"),
792794
span,
793795
);
794796
}
795797

796-
if intrinsic == "assert_uninit_valid" && !self.tcx.permits_uninit_init(layout) {
798+
if intrinsic == "assert_uninit_valid" && !self.tcx.permits_uninit_init(param_env_and_layout)
799+
{
797800
return self.codegen_fatal_error(
798801
PropertyClass::SafetyCheck,
799802
&format!("attempted to leave type `{ty}` uninitialized, which is invalid"),

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,13 @@ impl<'tcx> GotocCtx<'tcx> {
9797
let niche_value =
9898
variant_index.as_u32() - niche_variants.start().as_u32();
9999
let niche_value = (niche_value as u128).wrapping_add(*niche_start);
100-
let value =
101-
if niche_value == 0 && tag.primitive() == Primitive::Pointer {
102-
discr_ty.null()
103-
} else {
104-
Expr::int_constant(niche_value, discr_ty.clone())
105-
};
100+
let value = if niche_value == 0
101+
&& matches!(tag.primitive(), Primitive::Pointer(_))
102+
{
103+
discr_ty.null()
104+
} else {
105+
Expr::int_constant(niche_value, discr_ty.clone())
106+
};
106107
let place = unwrap_or_return_codegen_unimplemented_stmt!(
107108
self,
108109
self.codegen_place(place)
@@ -145,7 +146,8 @@ impl<'tcx> GotocCtx<'tcx> {
145146
| StatementKind::Retag(_, _)
146147
| StatementKind::AscribeUserType(_, _)
147148
| StatementKind::Nop
148-
| StatementKind::Coverage { .. } => Stmt::skip(location),
149+
| StatementKind::Coverage { .. }
150+
| StatementKind::ConstEvalCounter => Stmt::skip(location),
149151
}
150152
.with_location(location)
151153
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,11 @@ impl<'tcx> GotocCtx<'tcx> {
842842
ty::Bound(_, _) | ty::Param(_) => unreachable!("monomorphization bug"),
843843

844844
// type checking remnants which shouldn't be reachable
845-
ty::GeneratorWitness(_) | ty::Infer(_) | ty::Placeholder(_) | ty::Error(_) => {
845+
ty::GeneratorWitness(_)
846+
| ty::GeneratorWitnessMIR(_, _)
847+
| ty::Infer(_)
848+
| ty::Placeholder(_)
849+
| ty::Error(_) => {
846850
unreachable!("remnants of type checking")
847851
}
848852
}
@@ -1280,6 +1284,7 @@ impl<'tcx> GotocCtx<'tcx> {
12801284
ty::Bound(_, _) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
12811285
ty::Error(_) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
12821286
ty::GeneratorWitness(_) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
1287+
ty::GeneratorWitnessMIR(_, _) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
12831288
ty::Infer(_) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
12841289
ty::Param(_) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
12851290
ty::Placeholder(_) => todo!("{:?} {:?}", pointee_type, pointee_type.kind()),
@@ -1630,7 +1635,7 @@ impl<'tcx> GotocCtx<'tcx> {
16301635

16311636
Primitive::F32 => self.tcx.types.f32,
16321637
Primitive::F64 => self.tcx.types.f64,
1633-
Primitive::Pointer => {
1638+
Primitive::Pointer(_) => {
16341639
self.tcx.mk_ptr(ty::TypeAndMut { ty: self.tcx.types.u8, mutbl: Mutability::Not })
16351640
}
16361641
}

kani-compiler/src/kani_middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn resolve_prefix<'tcx>(
185185
let current_module_hir_id = tcx.hir().local_def_id_to_hir_id(current_module);
186186
let crate_root = match tcx.hir().parent_iter(current_module_hir_id).last() {
187187
None => current_module,
188-
Some((hir_id, _)) => tcx.hir().local_def_id(hir_id),
188+
Some((hir_id, _)) => hir_id.owner.def_id,
189189
};
190190
Ok(Path { base: crate_root.to_def_id(), segments: segments.collect() })
191191
}
@@ -227,7 +227,7 @@ where
227227
while segments.next_if(|segment| segment == SUPER).is_some() {
228228
if let Some((parent, _)) = parents.next() {
229229
debug!("parent: {parent:?}");
230-
base_module = tcx.hir().local_def_id(parent);
230+
base_module = parent.owner.def_id;
231231
} else {
232232
return Err(ResolveError::ExtraSuper);
233233
}

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-2023-01-23"
5+
channel = "nightly-2023-02-03"
66
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

tests/ui/code-location/expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module/mod.rs:10:5 in function module::not_empty
22
main.rs:13:5 in function same_file
33
/toolchains/
4-
alloc/src/vec/mod.rs:3059:81 in function <std::vec::Vec<i32> as std::ops::Drop>::drop
4+
alloc/src/vec/mod.rs:3030:81 in function <std::vec::Vec<i32> as std::ops::Drop>::drop
55

66
VERIFICATION:- SUCCESSFUL

0 commit comments

Comments
 (0)