Skip to content

Commit 12768f2

Browse files
authored
Upgrade Rust toolchain to nightly-2024-03-01 (#3052)
Upgrades the Rust toolchain to `nightly-2024-03-01`. The Rust compiler PRs that triggered changes in this upgrades are: * rust-lang/rust#121516 * rust-lang/rust#121598 * rust-lang/rust#121489 * rust-lang/rust#121783
1 parent 99ee1a6 commit 12768f2

File tree

38 files changed

+91
-228
lines changed

38 files changed

+91
-228
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,11 @@ impl<'tcx> GotocCtx<'tcx> {
415415
loc,
416416
"https://github.com/model-checking/kani/issues/374",
417417
),
418+
"catch_unwind" => self.codegen_unimplemented_stmt(
419+
intrinsic,
420+
loc,
421+
"https://github.com/model-checking/kani/issues/267",
422+
),
418423
"ceilf32" => codegen_simple_intrinsic!(Ceilf),
419424
"ceilf64" => codegen_simple_intrinsic!(Ceil),
420425
"compare_bytes" => self.codegen_compare_bytes(fargs, place, loc),
@@ -584,11 +589,6 @@ impl<'tcx> GotocCtx<'tcx> {
584589
"transmute" => self.codegen_intrinsic_transmute(fargs, ret_ty, place),
585590
"truncf32" => codegen_simple_intrinsic!(Truncf),
586591
"truncf64" => codegen_simple_intrinsic!(Trunc),
587-
"try" => self.codegen_unimplemented_stmt(
588-
intrinsic,
589-
loc,
590-
"https://github.com/model-checking/kani/issues/267",
591-
),
592592
"type_id" => codegen_intrinsic_const!(),
593593
"type_name" => codegen_intrinsic_const!(),
594594
"unaligned_volatile_load" => {

kani-compiler/src/session.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
//! Module used to configure a compiler session.
55
66
use crate::args::Arguments;
7+
use rustc_data_structures::sync::Lrc;
8+
use rustc_errors::emitter::Emitter;
79
use rustc_errors::{
8-
emitter::Emitter, emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter,
9-
ColorConfig, Diagnostic, TerminalUrl,
10+
emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter, ColorConfig,
11+
DiagInner,
1012
};
1113
use rustc_session::config::ErrorOutputType;
1214
use rustc_session::EarlyDiagCtxt;
15+
use rustc_span::source_map::FilePathMapping;
16+
use rustc_span::source_map::SourceMap;
17+
use std::io;
1318
use std::io::IsTerminal;
1419
use std::panic;
1520
use std::sync::LazyLock;
@@ -49,17 +54,15 @@ static JSON_PANIC_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send
4954
let msg = format!("Kani unexpectedly panicked at {info}.",);
5055
let fallback_bundle =
5156
fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
52-
let mut emitter = JsonEmitter::basic(
53-
false,
54-
HumanReadableErrorType::Default(ColorConfig::Never),
55-
None,
57+
let mut emitter = JsonEmitter::new(
58+
Box::new(io::BufWriter::new(io::stderr())),
59+
#[allow(clippy::arc_with_non_send_sync)]
60+
Lrc::new(SourceMap::new(FilePathMapping::empty())),
5661
fallback_bundle,
57-
None,
5862
false,
59-
false,
60-
TerminalUrl::No,
63+
HumanReadableErrorType::Default(ColorConfig::Never),
6164
);
62-
let diagnostic = Diagnostic::new(rustc_errors::Level::Bug, msg);
65+
let diagnostic = DiagInner::new(rustc_errors::Level::Bug, msg);
6366
emitter.emit_diagnostic(diagnostic);
6467
(*JSON_PANIC_HOOK)(info);
6568
}));

kani-driver/src/cbmc_property_renderer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ fn annotate_properties_with_reach_results(
837837
let prop_match_id =
838838
check_marker_pat.captures(description.as_str()).unwrap().get(0).unwrap().as_str();
839839
// Get the status associated to the ID we captured
840-
let reach_status_opt = reach_map.get(&prop_match_id.to_string());
840+
let reach_status_opt = reach_map.get(prop_match_id);
841841
// Update the reachability status of the property
842842
if let Some(reach_status) = reach_status_opt {
843843
prop.reach = Some(*reach_status);

library/kani/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Used to model simd.
1414
#![feature(repr_simd)]
1515
// Features used for tests only.
16-
#![cfg_attr(test, feature(platform_intrinsics, portable_simd))]
16+
#![cfg_attr(test, feature(core_intrinsics, portable_simd))]
1717
// Required for rustc_diagnostic_item
1818
#![allow(internal_features)]
1919

library/kani/src/models/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,9 @@ mod intrinsics {
127127
#[cfg(test)]
128128
mod test {
129129
use super::intrinsics as kani_intrinsic;
130+
use std::intrinsics::simd::*;
130131
use std::{fmt::Debug, simd::*};
131132

132-
extern "platform-intrinsic" {
133-
fn simd_bitmask<T, U>(x: T) -> U;
134-
}
135-
136133
/// Test that the `simd_bitmask` model is equivalent to the intrinsic for all true and all false
137134
/// masks with lanes represented using i16.
138135
#[test]

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

tests/cargo-kani/assess-artifacts/expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Analyzed 1 packages
33
Unsupported feature | Crates | Instances
44
| impacted | of use
55
---------------------+----------+-----------
6-
try | 1 | 2
6+
catch_unwind | 1 | 2
77
============================================
88
=========================================
99
Reason for failure | Number of tests

tests/cargo-kani/assess-workspace-artifacts/expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Analyzed 2 packages
33
Unsupported feature | Crates | Instances
44
| impacted | of use
55
---------------------+----------+-----------
6-
try | 2 | 3
6+
catch_unwind | 2 | 3
77
============================================
88
=========================================
99
Reason for failure | Number of tests

tests/expected/intrinsics/simd-arith-overflows/main.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! This test ensures we detect overflows in SIMD arithmetic operations
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::{simd_add, simd_mul, simd_sub};
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
1011
pub struct i8x2(i8, i8);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_add<T>(x: T, y: T) -> T;
14-
fn simd_sub<T>(x: T, y: T) -> T;
15-
fn simd_mul<T>(x: T, y: T) -> T;
16-
}
17-
1813
#[kani::proof]
1914
fn main() {
2015
let a = kani::any();

tests/expected/intrinsics/simd-cmp-result-type-is-diff-size/main.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
//! Checks that storing the result of a vector operation in a vector of
55
//! size different to the operands' sizes causes an error.
6-
#![feature(repr_simd, platform_intrinsics)]
6+
#![feature(repr_simd, core_intrinsics)]
7+
use std::intrinsics::simd::simd_eq;
78

89
#[repr(simd)]
910
#[allow(non_camel_case_types)]
@@ -20,14 +21,6 @@ pub struct u64x2(u64, u64);
2021
#[derive(Clone, Copy, PartialEq, Eq)]
2122
pub struct u32x4(u32, u32, u32, u32);
2223

23-
// From <https://github.com/rust-lang/rfcs/blob/master/text/1199-simd-infrastructure.md#comparisons>:
24-
// > The type checker ensures that `T` and `U` have the same length, and that
25-
// > `U` is appropriately "boolean"-y.
26-
// This means that `U` is allowed to be `i64` or `u64`, but not `f64`.
27-
extern "platform-intrinsic" {
28-
fn simd_eq<T, U>(x: T, y: T) -> U;
29-
}
30-
3124
#[kani::proof]
3225
fn main() {
3326
let x = u64x2(0, 0);

tests/expected/intrinsics/simd-div-div-zero/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_div` triggers a failure when the divisor is zero.
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_div;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_div<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_div() {
1815
let dividend = kani::any();

tests/expected/intrinsics/simd-div-rem-overflow/main.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
// Checks that the `simd_div` and `simd_rem` intrinsics check for integer overflows.
5-
6-
#![feature(repr_simd, platform_intrinsics)]
4+
//! Checks that the `simd_div` and `simd_rem` intrinsics check for integer overflows.
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::{simd_div, simd_rem};
77

88
#[repr(simd)]
99
#[allow(non_camel_case_types)]
1010
#[derive(Clone, Copy, PartialEq, Eq)]
1111
pub struct i32x2(i32, i32);
1212

13-
extern "platform-intrinsic" {
14-
fn simd_div<T>(x: T, y: T) -> T;
15-
fn simd_rem<T>(x: T, y: T) -> T;
16-
}
17-
1813
unsafe fn do_simd_div(dividends: i32x2, divisors: i32x2) -> i32x2 {
1914
simd_div(dividends, divisors)
2015
}

tests/expected/intrinsics/simd-extract-wrong-type/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
//! This test checks that we emit an error when the return type for
55
//! `simd_extract` has a type different to the first argument's (i.e., the
66
//! vector) base type.
7-
#![feature(repr_simd, platform_intrinsics)]
7+
#![feature(repr_simd, core_intrinsics)]
8+
use std::intrinsics::simd::simd_extract;
89

910
#[repr(simd)]
1011
#[allow(non_camel_case_types)]
1112
#[derive(Clone, Copy, PartialEq, Eq)]
1213
pub struct i64x2(i64, i64);
1314

14-
extern "platform-intrinsic" {
15-
fn simd_extract<T, U>(x: T, idx: u32) -> U;
16-
}
17-
1815
#[kani::proof]
1916
fn main() {
2017
let y = i64x2(0, 1);

tests/expected/intrinsics/simd-insert-wrong-type/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
//! This test checks that we emit an error when the third argument for
55
//! `simd_insert` (the value to be inserted) has a type different to the first
66
//! argument's (i.e., the vector) base type.
7-
#![feature(repr_simd, platform_intrinsics)]
7+
#![feature(repr_simd, core_intrinsics)]
8+
use std::intrinsics::simd::simd_insert;
89

910
#[repr(simd)]
1011
#[allow(non_camel_case_types)]
1112
#[derive(Clone, Copy, PartialEq, Eq)]
1213
pub struct i64x2(i64, i64);
1314

14-
extern "platform-intrinsic" {
15-
fn simd_insert<T, U>(x: T, idx: u32, b: U) -> T;
16-
}
17-
1815
#[kani::proof]
1916
fn main() {
2017
let y = i64x2(0, 1);

tests/expected/intrinsics/simd-rem-div-zero/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_rem` triggers a failure when the divisor is zero
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_rem;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_rem<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_rem() {
1815
let dividend = kani::any();

tests/expected/intrinsics/simd-result-type-is-float/main.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
//! Checks that storing the result of a vector comparison in a vector of floats
55
//! causes an error.
6-
#![feature(repr_simd, platform_intrinsics)]
6+
#![feature(repr_simd, core_intrinsics)]
7+
use std::intrinsics::simd::simd_eq;
78

89
#[repr(simd)]
910
#[allow(non_camel_case_types)]
@@ -25,14 +26,6 @@ pub struct u32x4(u32, u32, u32, u32);
2526
#[derive(Clone, Copy, PartialEq)]
2627
pub struct f32x2(f32, f32);
2728

28-
// From <https://github.com/rust-lang/rfcs/blob/master/text/1199-simd-infrastructure.md#comparisons>:
29-
// > The type checker ensures that `T` and `U` have the same length, and that
30-
// > `U` is appropriately "boolean"-y.
31-
// This means that `U` is allowed to be `i64` or `u64`, but not `f64`.
32-
extern "platform-intrinsic" {
33-
fn simd_eq<T, U>(x: T, y: T) -> U;
34-
}
35-
3629
#[kani::proof]
3730
fn main() {
3831
let x = u64x2(0, 0);

tests/expected/intrinsics/simd-shl-shift-negative/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_shl` returns a failure if the shift distance is negative.
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_shl;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_shl<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_shl() {
1815
let value = kani::any();

tests/expected/intrinsics/simd-shl-shift-too-large/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_shl` returns a failure if the shift distance is too large.
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_shl;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_shl<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_shl() {
1815
let value = kani::any();

tests/expected/intrinsics/simd-shr-shift-negative/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_shr` returns a failure if the shift distance is negative.
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_shr;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_shr<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_shr() {
1815
let value = kani::any();

tests/expected/intrinsics/simd-shr-shift-too-large/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
//! Checks that `simd_shr` returns a failure if the shift distance is too large.
5-
#![feature(repr_simd, platform_intrinsics)]
5+
#![feature(repr_simd, core_intrinsics)]
6+
use std::intrinsics::simd::simd_shr;
67

78
#[repr(simd)]
89
#[allow(non_camel_case_types)]
910
#[derive(Clone, Copy, PartialEq, Eq)]
1011
pub struct i32x2(i32, i32);
1112

12-
extern "platform-intrinsic" {
13-
fn simd_shr<T>(x: T, y: T) -> T;
14-
}
15-
1613
#[kani::proof]
1714
fn test_simd_shr() {
1815
let value = kani::any();

0 commit comments

Comments
 (0)