Skip to content

Commit 52a5b77

Browse files
authored
Upgrade toolchain to 2024-05-14 (rust-lang#3183)
Relevant upstream PRs: rust-lang#124797 rust-lang#124957 rust-lang#124003
1 parent 997a54c commit 52a5b77

35 files changed

+241
-130
lines changed

cprover_bindings/src/goto_program/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,11 +1331,11 @@ impl Expr {
13311331
fn unop_return_type(op: UnaryOperator, arg: &Expr) -> Type {
13321332
match op {
13331333
Bitnot | BitReverse | Bswap | UnaryMinus => arg.typ.clone(),
1334-
CountLeadingZeros { .. } | CountTrailingZeros { .. } => arg.typ.clone(),
1334+
CountLeadingZeros { .. } | CountTrailingZeros { .. } => Type::unsigned_int(32),
13351335
ObjectSize | PointerObject => Type::size_t(),
13361336
PointerOffset => Type::ssize_t(),
13371337
IsDynamicObject | IsFinite | Not => Type::bool(),
1338-
Popcount => arg.typ.clone(),
1338+
Popcount => Type::unsigned_int(32),
13391339
}
13401340
}
13411341
/// Private helper function to make unary operators

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_middle::ty::{List, TypeFoldable};
1818
use rustc_smir::rustc_internal;
1919
use rustc_span::def_id::DefId;
2020
use rustc_target::abi::{
21-
Abi::Vector, FieldIdx, FieldsShape, Integer, LayoutS, Primitive, Size, TagEncoding,
21+
Abi::Vector, FieldIdx, FieldsShape, Float, Integer, LayoutS, Primitive, Size, TagEncoding,
2222
TyAndLayout, VariantIdx, Variants,
2323
};
2424
use stable_mir::abi::{ArgAbi, FnAbi, PassMode};
@@ -1354,13 +1354,18 @@ impl<'tcx> GotocCtx<'tcx> {
13541354
}
13551355
}
13561356
},
1357+
Primitive::Float(f) => self.codegen_float_type(f),
1358+
Primitive::Pointer(_) => Ty::new_ptr(self.tcx, self.tcx.types.u8, Mutability::Not),
1359+
}
1360+
}
13571361

1358-
Primitive::F32 => self.tcx.types.f32,
1359-
Primitive::F64 => self.tcx.types.f64,
1362+
pub fn codegen_float_type(&self, f: Float) -> Ty<'tcx> {
1363+
match f {
1364+
Float::F32 => self.tcx.types.f32,
1365+
Float::F64 => self.tcx.types.f64,
13601366
// `F16` and `F128` are not yet handled.
13611367
// Tracked here: <https://github.com/model-checking/kani/issues/3069>
1362-
Primitive::F16 | Primitive::F128 => unimplemented!(),
1363-
Primitive::Pointer(_) => Ty::new_ptr(self.tcx, self.tcx.types.u8, Mutability::Not),
1368+
Float::F16 | Float::F128 => unimplemented!(),
13641369
}
13651370
}
13661371

@@ -1672,7 +1677,7 @@ pub fn pointee_type(mir_type: Ty) -> Option<Ty> {
16721677
/// Extracts the pointee type if the given mir type is either a known smart pointer (Box, Rc, ..)
16731678
/// or a regular pointer.
16741679
pub fn std_pointee_type(mir_type: Ty) -> Option<Ty> {
1675-
mir_type.builtin_deref(true).map(|tm| tm.ty)
1680+
mir_type.builtin_deref(true)
16761681
}
16771682

16781683
/// This is a place holder function that should normalize the given type.

kani-compiler/src/kani_middle/coercion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use rustc_hir::lang_items::LangItem;
1717
use rustc_middle::traits::{ImplSource, ImplSourceUserDefinedData};
1818
use rustc_middle::ty::adjustment::CustomCoerceUnsized;
19+
use rustc_middle::ty::TraitRef;
1920
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
20-
use rustc_middle::ty::{TraitRef, TypeAndMut};
2121
use rustc_smir::rustc_internal;
2222
use stable_mir::ty::{RigidTy, Ty as TyStable, TyKind};
2323
use stable_mir::Symbol;
@@ -263,5 +263,5 @@ fn custom_coerce_unsize_info<'tcx>(
263263

264264
/// Extract pointee type from builtin pointer types.
265265
fn extract_pointee(tcx: TyCtxt<'_>, typ: TyStable) -> Option<Ty<'_>> {
266-
rustc_internal::internal(tcx, typ).builtin_deref(true).map(|TypeAndMut { ty, .. }| ty)
266+
rustc_internal::internal(tcx, typ).builtin_deref(true)
267267
}

library/kani_macros/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
fn main() {
5+
// Make sure `kani_sysroot` is a recognized config
6+
println!("cargo::rustc-check-cfg=cfg(kani_sysroot)");
7+
}

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

tests/expected/coroutines/as_parameter/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ where
2121

2222
#[kani::proof]
2323
fn main() {
24-
foo(|| {
25-
yield 1;
26-
return 2;
27-
});
24+
foo(
25+
#[coroutine]
26+
|| {
27+
yield 1;
28+
return 2;
29+
},
30+
);
2831
}

tests/expected/coroutines/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
#![feature(coroutines, coroutine_trait)]
5+
#![feature(stmt_expr_attributes)]
56

67
use std::ops::{Coroutine, CoroutineState};
78
use std::pin::Pin;
@@ -10,7 +11,8 @@ use std::pin::Pin;
1011
#[kani::unwind(2)]
1112
fn main() {
1213
let val: bool = kani::any();
13-
let mut coroutine = move || {
14+
let mut coroutine = #[coroutine]
15+
move || {
1416
let x = val;
1517
yield x;
1618
return !x;

tests/expected/coroutines/pin/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
// from https://github.com/model-checking/kani/issues/416
66

77
#![feature(coroutines, coroutine_trait)]
8+
#![feature(stmt_expr_attributes)]
89

910
use std::ops::{Coroutine, CoroutineState};
1011
use std::pin::Pin;
1112

1213
#[kani::proof]
1314
fn main() {
14-
let mut coroutine = || {
15+
let mut coroutine = #[coroutine]
16+
|| {
1517
yield 1;
1618
return true;
1719
};

tests/expected/intrinsics/ctpop-ice/ctpop_ice.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/expected/intrinsics/ctpop-ice/expected

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)