Skip to content

Commit 5ead032

Browse files
authored
Upgrade Rust toolchain to 2025-11-13 (#4473)
Relevant upstream PR: - rust-lang/rust#148531 (rustc_target: introduce Abi, Env, Os) Resolves: #4471 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent e5f1a80 commit 5ead032

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

kani-compiler/src/codegen_aeneas_llbc/compiler_interface.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use rustc_public::{CrateDef, DefId};
3939
use rustc_session::Session;
4040
use rustc_session::config::{CrateType, OutputFilenames, OutputType};
4141
use rustc_session::output::out_filename;
42+
use rustc_target::spec::Arch;
4243
use std::any::Any;
4344
use std::fs::File;
4445
use std::path::Path;
@@ -376,7 +377,14 @@ fn codegen_results(tcx: TyCtxt) -> Box<dyn Any> {
376377
CodegenResults {
377378
modules: vec![],
378379
allocator_module: None,
379-
crate_info: CrateInfo::new(tcx, tcx.sess.target.arch.clone().to_string()),
380+
crate_info: CrateInfo::new(
381+
tcx,
382+
match tcx.sess.target.arch {
383+
Arch::X86_64 => "x86_64".to_string(),
384+
Arch::AArch64 => "aarch64".to_string(),
385+
_ => format!("{:?}", tcx.sess.target.arch).to_lowercase(),
386+
},
387+
),
380388
},
381389
work_products,
382390
))

kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use rustc_session::Session;
4343
use rustc_session::config::{CrateType, OutputFilenames, OutputType};
4444
use rustc_session::output::out_filename;
4545
use rustc_span::{Symbol, sym};
46-
use rustc_target::spec::{Arch, PanicStrategy};
46+
use rustc_target::spec::{Arch, Os, PanicStrategy};
4747
use std::any::Any;
4848
use std::cmp::min;
4949
use std::collections::BTreeMap;
@@ -302,15 +302,15 @@ impl CodegenBackend for GotocCodegenBackend {
302302
fn target_config(&self, sess: &Session) -> TargetConfig {
303303
// This code is adapted from the cranelift backend:
304304
// https://github.com/rust-lang/rust/blob/a124fb3cb7291d75872934f411d81fe298379ace/compiler/rustc_codegen_cranelift/src/lib.rs#L184
305-
let target_features = if sess.target.arch == Arch::X86_64 && sess.target.os != "none" {
305+
let target_features = if sess.target.arch == Arch::X86_64 && sess.target.os != Os::None {
306306
// x86_64 mandates SSE2 support and rustc requires the x87 feature to be enabled
307307
vec![sym::sse, sym::sse2, Symbol::intern("x87")]
308308
} else if sess.target.arch == Arch::AArch64 {
309-
match &*sess.target.os {
310-
"none" => vec![],
309+
match sess.target.os {
310+
Os::None => vec![],
311311
// On macOS the aes, sha2 and sha3 features are enabled by default and ring
312312
// fails to compile on macOS when they are not present.
313-
"macos" => vec![sym::neon, sym::aes, sym::sha2, sym::sha3],
313+
Os::MacOs => vec![sym::neon, sym::aes, sym::sha2, sym::sha3],
314314
// AArch64 mandates Neon support
315315
_ => vec![sym::neon],
316316
}
@@ -818,7 +818,11 @@ fn new_machine_model(sess: &Session) -> MachineModel {
818818
let wchar_t_width = 32;
819819

820820
MachineModel {
821-
architecture: architecture.to_string(),
821+
architecture: match architecture {
822+
Arch::X86_64 => "x86_64".to_string(),
823+
Arch::AArch64 => "aarch64".to_string(),
824+
_ => panic!("Unsupported architecture: {:?}", architecture),
825+
},
822826
alignment,
823827
bool_width,
824828
char_is_unsigned,
@@ -848,8 +852,8 @@ fn new_machine_model(sess: &Session) -> MachineModel {
848852
let double_width = 64;
849853
let float_width = 32;
850854
let int_width = 32;
851-
let long_double_width = match os.as_ref() {
852-
"linux" => 128,
855+
let long_double_width = match os {
856+
Os::Linux => 128,
853857
_ => 64,
854858
};
855859
let long_int_width = 64;
@@ -859,7 +863,7 @@ fn new_machine_model(sess: &Session) -> MachineModel {
859863
// https://developer.arm.com/documentation/dui0491/i/Compiler-Command-line-Options/--signed-chars----unsigned-chars
860864
// https://www.arm.linux.org.uk/docs/faqs/signedchar.php
861865
// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
862-
let wchar_t_is_unsigned = matches!(os.as_ref(), "linux");
866+
let wchar_t_is_unsigned = matches!(os, Os::Linux);
863867
let wchar_t_width = 32;
864868

865869
MachineModel {

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-2025-11-12"
5+
channel = "nightly-2025-11-13"
66
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]

0 commit comments

Comments
 (0)