Skip to content

Commit 0a371ce

Browse files
committed
Upgrade toolchain to 2024-03-11
1 parent a8db120 commit 0a371ce

File tree

9 files changed

+37
-13
lines changed

9 files changed

+37
-13
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ impl<'tcx> GotocCtx<'tcx> {
474474
let binop_stmt = codegen_intrinsic_binop!(sub);
475475
self.add_finite_args_checks(intrinsic, fargs_clone, binop_stmt, span)
476476
}
477+
"is_val_statically_known" => {
478+
// Returning false is sound according do this intrinsic's documentation:
479+
// https://doc.rust-lang.org/nightly/std/intrinsics/fn.is_val_statically_known.html
480+
self.codegen_expr_to_place_stable(place, Expr::c_false())
481+
}
477482
"likely" => self.codegen_expr_to_place_stable(place, fargs.remove(0)),
478483
"log10f32" => unstable_codegen!(codegen_simple_intrinsic!(Log10f)),
479484
"log10f64" => unstable_codegen!(codegen_simple_intrinsic!(Log10)),
@@ -506,6 +511,7 @@ impl<'tcx> GotocCtx<'tcx> {
506511
"ptr_offset_from" => self.codegen_ptr_offset_from(fargs, place, loc),
507512
"ptr_offset_from_unsigned" => self.codegen_ptr_offset_from_unsigned(fargs, place, loc),
508513
"raw_eq" => self.codegen_intrinsic_raw_eq(instance, fargs, place, loc),
514+
"retag_box_to_raw" => self.codegen_retag_box_to_raw(fargs, place, loc),
509515
"rintf32" => codegen_simple_intrinsic!(Rintf),
510516
"rintf64" => codegen_simple_intrinsic!(Rint),
511517
"rotate_left" => codegen_intrinsic_binop!(rol),
@@ -1259,6 +1265,19 @@ impl<'tcx> GotocCtx<'tcx> {
12591265
self.codegen_expr_to_place_stable(p, e)
12601266
}
12611267

1268+
// This is an operation that is primarily relevant for stacked borrow
1269+
// checks. For Kani, we simply return the pointer.
1270+
fn codegen_retag_box_to_raw(
1271+
&mut self,
1272+
mut fargs: Vec<Expr>,
1273+
p: &Place,
1274+
_loc: Location,
1275+
) -> Stmt {
1276+
assert_eq!(fargs.len(), 1, "raw_box_to_box expected one argument");
1277+
let arg = fargs.remove(0);
1278+
self.codegen_expr_to_place_stable(p, arg)
1279+
}
1280+
12621281
fn vtable_info(
12631282
&mut self,
12641283
info: VTableInfo,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ impl<'tcx> GotocCtx<'tcx> {
725725
.bytes(),
726726
Type::size_t(),
727727
),
728-
NullOp::DebugAssertions => Expr::c_false(),
728+
NullOp::UbCheck(_) => Expr::c_false(),
729729
}
730730
}
731731
Rvalue::ShallowInitBox(ref operand, content_ty) => {

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

+6
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ impl<'tcx> GotocCtx<'tcx> {
542542
ty::Float(k) => match k {
543543
FloatTy::F32 => Type::float(),
544544
FloatTy::F64 => Type::double(),
545+
// `F16` and `F128` are not yet handled.
546+
// Tracked here: <https://github.com/model-checking/kani/issues/3069>
547+
FloatTy::F16 | FloatTy::F128 => unimplemented!(),
545548
},
546549
ty::Adt(def, _) if def.repr().simd() => self.codegen_vector(ty),
547550
ty::Adt(def, subst) => {
@@ -1346,6 +1349,9 @@ impl<'tcx> GotocCtx<'tcx> {
13461349

13471350
Primitive::F32 => self.tcx.types.f32,
13481351
Primitive::F64 => self.tcx.types.f64,
1352+
// `F16` and `F128` are not yet handled.
1353+
// Tracked here: <https://github.com/model-checking/kani/issues/3069>
1354+
Primitive::F16 | Primitive::F128 => unimplemented!(),
13491355
Primitive::Pointer(_) => Ty::new_ptr(
13501356
self.tcx,
13511357
ty::TypeAndMut { ty: self.tcx.types.u8, mutbl: Mutability::Not },

kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl CodegenBackend for GotocCodegenBackend {
397397
let path = MaybeTempDir::new(tmp_dir, sess.opts.cg.save_temps);
398398
let (metadata, _metadata_position) = create_wrapper_file(
399399
sess,
400-
b".rmeta".to_vec(),
400+
".rmeta".to_string(),
401401
codegen_results.metadata.raw_data(),
402402
);
403403
let metadata = emit_wrapper_file(sess, &metadata, &path, METADATA_FILENAME);

kani-compiler/src/kani_middle/attributes.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,8 @@ fn parse_modify_values<'a>(
611611
let mut iter = t.trees();
612612
std::iter::from_fn(move || {
613613
let tree = iter.next()?;
614-
let wrong_token_err = || {
615-
tcx.sess.parse_sess.dcx.span_err(tree.span(), "Unexpected token. Expected identifier.")
616-
};
614+
let wrong_token_err =
615+
|| tcx.sess.psess.dcx.span_err(tree.span(), "Unexpected token. Expected identifier.");
617616
let result = match tree {
618617
TokenTree::Token(token, _) => {
619618
if let TokenKind::Ident(id, _) = &token.kind {
@@ -640,7 +639,7 @@ fn parse_modify_values<'a>(
640639
match iter.next() {
641640
None | Some(comma_tok!()) => (),
642641
Some(not_comma) => {
643-
tcx.sess.parse_sess.dcx.span_err(
642+
tcx.sess.psess.dcx.span_err(
644643
not_comma.span(),
645644
"Unexpected token, expected end of attribute or comma",
646645
);

kani-compiler/src/kani_middle/intrinsics.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_index::IndexVec;
66
use rustc_middle::mir::{Body, Const as mirConst, ConstValue, Operand, TerminatorKind};
77
use rustc_middle::mir::{Local, LocalDecl};
88
use rustc_middle::ty::{self, Ty, TyCtxt};
9-
use rustc_middle::ty::{Const, GenericArgsRef};
9+
use rustc_middle::ty::{Const, GenericArgsRef, IntrinsicDef};
1010
use rustc_span::source_map::Spanned;
1111
use rustc_span::symbol::{sym, Symbol};
1212
use tracing::{debug, trace};
@@ -33,8 +33,8 @@ impl<'tcx> ModelIntrinsics<'tcx> {
3333
let terminator = block.terminator_mut();
3434
if let TerminatorKind::Call { func, args, .. } = &mut terminator.kind {
3535
let func_ty = func.ty(&self.local_decls, self.tcx);
36-
if let Some((intrinsic_name, generics)) = resolve_rust_intrinsic(self.tcx, func_ty)
37-
{
36+
if let Some((intrinsic, generics)) = resolve_rust_intrinsic(self.tcx, func_ty) {
37+
let intrinsic_name = intrinsic.name;
3838
trace!(?func, ?intrinsic_name, "run_pass");
3939
if intrinsic_name == sym::simd_bitmask {
4040
self.replace_simd_bitmask(func, args, generics)
@@ -99,7 +99,7 @@ fn simd_len_and_type<'tcx>(tcx: TyCtxt<'tcx>, simd_ty: Ty<'tcx>) -> (Const<'tcx>
9999
fn resolve_rust_intrinsic<'tcx>(
100100
tcx: TyCtxt<'tcx>,
101101
func_ty: Ty<'tcx>,
102-
) -> Option<(Symbol, GenericArgsRef<'tcx>)> {
102+
) -> Option<(IntrinsicDef, GenericArgsRef<'tcx>)> {
103103
if let ty::FnDef(def_id, args) = *func_ty.kind() {
104104
if let Some(symbol) = tcx.intrinsic(def_id) {
105105
return Some((symbol, args));

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

tests/coverage/unreachable/variant/expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
coverage/unreachable/variant/main.rs, 15, PARTIAL
1+
coverage/unreachable/variant/main.rs, 15, FULL
22
coverage/unreachable/variant/main.rs, 16, NONE
33
coverage/unreachable/variant/main.rs, 17, NONE
44
coverage/unreachable/variant/main.rs, 18, FULL

tools/bookrunner/librustdoc/html/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl LangString {
225225
let mut data = LangString::default();
226226
let mut ignores = vec![];
227227

228-
data.original = string.to_owned();
228+
string.clone_into(&mut data.original);
229229

230230
for token in Self::tokens(string) {
231231
match token {

0 commit comments

Comments
 (0)