Skip to content

Commit 3c1ef5f

Browse files
authored
Upgrade toolchain to 2024-12-12 (#3774)
Upgrade toolchain to 12/12. The only substantive changes are for the 12/10 toolchain; 12/11 and 12/12 are just updating the LLBC tests. Culprit PR: rust-lang/rust#133567 (specifically [this commit](rust-lang/rust@401dd84) and [this commit](rust-lang/rust@030545d)). Resolves #3770 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 2334f2c commit 3c1ef5f

File tree

11 files changed

+18
-264
lines changed

11 files changed

+18
-264
lines changed

kani-compiler/src/codegen_aeneas_llbc/compiler_interface.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,23 +320,15 @@ impl CodegenBackend for LlbcCodegenBackend {
320320
/// For cases where no metadata file was requested, we stub the file requested by writing the
321321
/// path of the `kani-metadata.json` file so `kani-driver` can safely find the latest metadata.
322322
/// See <https://github.com/model-checking/kani/issues/2234> for more details.
323-
fn link(
324-
&self,
325-
sess: &Session,
326-
codegen_results: CodegenResults,
327-
outputs: &OutputFilenames,
328-
) -> Result<(), ErrorGuaranteed> {
323+
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) {
329324
let requested_crate_types = &codegen_results.crate_info.crate_types.clone();
330325
let local_crate_name = codegen_results.crate_info.local_crate_name;
331-
let link_result = link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs);
326+
link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs);
332327
for crate_type in requested_crate_types {
333328
let out_fname = out_filename(sess, *crate_type, outputs, local_crate_name);
334329
let out_path = out_fname.as_path();
335330
debug!(?crate_type, ?out_path, "link");
336-
if *crate_type == CrateType::Rlib {
337-
// Emit the `rlib` that contains just one file: `<crate>.rmeta`
338-
link_result?
339-
} else {
331+
if *crate_type != CrateType::Rlib {
340332
// Write the location of the kani metadata file in the requested compiler output file.
341333
let base_filepath = outputs.path(OutputType::Object);
342334
let base_filename = base_filepath.as_path();
@@ -347,7 +339,6 @@ impl CodegenBackend for LlbcCodegenBackend {
347339
serde_json::to_writer(out_file, &content_stub).unwrap();
348340
}
349341
}
350-
Ok(())
351342
}
352343
}
353344

kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_codegen_ssa::back::link::link_binary;
3030
use rustc_codegen_ssa::traits::CodegenBackend;
3131
use rustc_codegen_ssa::{CodegenResults, CrateInfo};
3232
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
33-
use rustc_errors::{DEFAULT_LOCALE_RESOURCE, ErrorGuaranteed};
33+
use rustc_errors::DEFAULT_LOCALE_RESOURCE;
3434
use rustc_hir::def_id::{DefId as InternalDefId, LOCAL_CRATE};
3535
use rustc_metadata::EncodedMetadata;
3636
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
@@ -414,17 +414,12 @@ impl CodegenBackend for GotocCodegenBackend {
414414
/// For other crate types, we stub the file requested by writing the
415415
/// path of the `kani-metadata.json` file so `kani-driver` can safely find the latest metadata.
416416
/// See <https://github.com/model-checking/kani/issues/2234> for more details.
417-
fn link(
418-
&self,
419-
sess: &Session,
420-
codegen_results: CodegenResults,
421-
outputs: &OutputFilenames,
422-
) -> Result<(), ErrorGuaranteed> {
417+
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) {
423418
let requested_crate_types = &codegen_results.crate_info.crate_types.clone();
424419
let local_crate_name = codegen_results.crate_info.local_crate_name;
425420
// Create the rlib if one was requested.
426421
if requested_crate_types.iter().any(|crate_type| *crate_type == CrateType::Rlib) {
427-
link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs)?;
422+
link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs);
428423
}
429424

430425
// But override all the other outputs.
@@ -445,7 +440,6 @@ impl CodegenBackend for GotocCodegenBackend {
445440
serde_json::to_writer(out_file, &content_stub).unwrap();
446441
}
447442
}
448-
Ok(())
449443
}
450444
}
451445

kani-compiler/src/kani_compiler.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,14 @@ use rustc_interface::Config;
3030
use rustc_middle::ty::TyCtxt;
3131
use rustc_session::config::ErrorOutputType;
3232
use rustc_smir::rustc_internal;
33-
use rustc_span::ErrorGuaranteed;
34-
use std::process::ExitCode;
3533
use std::sync::{Arc, Mutex};
3634
use tracing::debug;
3735

3836
/// Run the Kani flavour of the compiler.
3937
/// This may require multiple runs of the rustc driver ([RunCompiler::run]).
40-
pub fn run(args: Vec<String>) -> ExitCode {
38+
pub fn run(args: Vec<String>) {
4139
let mut kani_compiler = KaniCompiler::new();
42-
match kani_compiler.run(args) {
43-
Ok(()) => ExitCode::SUCCESS,
44-
Err(_) => ExitCode::FAILURE,
45-
}
40+
kani_compiler.run(args);
4641
}
4742

4843
/// Configure the LLBC backend (Aeneas's IR).
@@ -99,13 +94,12 @@ impl KaniCompiler {
9994
///
10095
/// Since harnesses may have different attributes that affect compilation, Kani compiler can
10196
/// actually invoke the rust compiler multiple times.
102-
pub fn run(&mut self, args: Vec<String>) -> Result<(), ErrorGuaranteed> {
97+
pub fn run(&mut self, args: Vec<String>) {
10398
debug!(?args, "run_compilation_session");
10499
let queries = self.queries.clone();
105100
let mut compiler = RunCompiler::new(&args, self);
106101
compiler.set_make_codegen_backend(Some(Box::new(move |_cfg| backend(queries))));
107-
compiler.run()?;
108-
Ok(())
102+
compiler.run();
109103
}
110104
}
111105

kani-compiler/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,19 @@ mod session;
5151

5252
use rustc_driver::{RunCompiler, TimePassesCallbacks};
5353
use std::env;
54-
use std::process::ExitCode;
5554

5655
/// Main function. Configure arguments and run the compiler.
57-
fn main() -> ExitCode {
56+
fn main() {
5857
session::init_panic_hook();
5958
let (kani_compiler, rustc_args) = is_kani_compiler(env::args().collect());
6059

6160
// Configure and run compiler.
6261
if kani_compiler {
63-
kani_compiler::run(rustc_args)
62+
kani_compiler::run(rustc_args);
6463
} else {
6564
let mut callbacks = TimePassesCallbacks::default();
6665
let compiler = RunCompiler::new(&rustc_args, &mut callbacks);
67-
if compiler.run().is_err() { ExitCode::FAILURE } else { ExitCode::SUCCESS }
66+
compiler.run();
6867
}
6968
}
7069

kani-compiler/src/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
66
use crate::args::Arguments;
77
use rustc_data_structures::sync::Lrc;
8-
use rustc_errors::emitter::Emitter;
98
use rustc_errors::{
10-
ColorConfig, DiagInner, emitter::HumanReadableErrorType, fallback_fluent_bundle,
11-
json::JsonEmitter,
9+
ColorConfig, DiagInner, emitter::Emitter, emitter::HumanReadableErrorType,
10+
fallback_fluent_bundle, json::JsonEmitter, registry::Registry as ErrorRegistry,
1211
};
1312
use rustc_session::EarlyDiagCtxt;
1413
use rustc_session::config::ErrorOutputType;
@@ -64,8 +63,9 @@ static JSON_PANIC_HOOK: LazyLock<Box<dyn Fn(&panic::PanicHookInfo<'_>) + Sync +
6463
HumanReadableErrorType::Default,
6564
ColorConfig::Never,
6665
);
66+
let registry = ErrorRegistry::new(&[]);
6767
let diagnostic = DiagInner::new(rustc_errors::Level::Bug, msg);
68-
emitter.emit_diagnostic(diagnostic);
68+
emitter.emit_diagnostic(diagnostic, &registry);
6969
(*JSON_PANIC_HOOK)(info);
7070
}));
7171
hook

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

tests/expected/llbc/enum/expected

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +0,0 @@
1-
enum test::MyEnum =
2-
| A(0: i32)
3-
| B()
4-
5-
6-
fn test::enum_match(@1: @Adt0) -> i32
7-
{
8-
let @0: i32; // return
9-
let e@1: @Adt0; // arg #1
10-
let i@2: i32; // local
11-
12-
match e@1 {
13-
0 => {
14-
i@2 := copy ((e@1 as variant @0).0)
15-
@0 := copy (i@2)
16-
drop i@2
17-
},
18-
1 => {
19-
@0 := const (0 : i32)
20-
},
21-
}
22-
return
23-
}
24-
25-
fn test::main()
26-
{
27-
let @0: (); // return
28-
let e@1: @Adt0; // local
29-
let i@2: i32; // local
30-
31-
e@1 := test::MyEnum::A { 0: const (1 : i32) }
32-
i@2 := @Fun0(move (e@1))
33-
drop i@2
34-
@0 := ()
35-
return
36-
}
37-

tests/expected/llbc/generic/expected

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +0,0 @@
1-
enum core::option::Option<T> =
2-
| None()
3-
| Some(0: T)
4-
5-
6-
fn test::add_opt(@1: @Adt0<i32>, @2: @Adt0<i32>) -> @Adt0<i32>
7-
{
8-
let @0: @Adt0<i32>; // return
9-
let x@1: @Adt0<i32>; // arg #1
10-
let y@2: @Adt0<i32>; // arg #2
11-
let u@3: i32; // local
12-
let v@4: i32; // local
13-
let @5: i32; // anonymous local
14-
15-
match x@1 {
16-
1 => {
17-
u@3 := copy ((x@1 as variant @1).0)
18-
match y@2 {
19-
1 => {
20-
v@4 := copy ((y@2 as variant @1).0)
21-
@5 := copy (u@3) + copy (v@4)
22-
@0 := core::option::Option::Some { 0: move (@5) }
23-
drop @5
24-
},
25-
0 => {
26-
@0 := core::option::Option::None { }
27-
},
28-
}
29-
},
30-
0 => {
31-
@0 := core::option::Option::None { }
32-
},
33-
}
34-
return
35-
}
36-
37-
fn test::main()
38-
{
39-
let @0: (); // return
40-
let e@1: @Adt0<i32>; // local
41-
let @2: @Adt0<i32>; // anonymous local
42-
let @3: @Adt0<i32>; // anonymous local
43-
44-
@2 := core::option::Option::Some { 0: const (1 : i32) }
45-
@3 := core::option::Option::Some { 0: const (2 : i32) }
46-
e@1 := @Fun0(move (@2), move (@3))
47-
drop @3
48-
drop @2
49-
drop e@1
50-
@0 := ()
51-
return
52-
}
Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +0,0 @@
1-
struct test::MyStruct =
2-
{
3-
a: i32,
4-
b: i32,
5-
}
6-
enum test::MyEnum0 =
7-
| A(0: @Adt1, 1: i32)
8-
| B()
9-
enum test::MyEnum =
10-
| A(0: @Adt1, 1: @Adt2)
11-
| B(0: (i32, i32))
12-
13-
fn test::enum_match(@1: @Adt0) -> i32
14-
{
15-
let @0: i32; // return
16-
let e@1: @Adt0; // arg #1
17-
let s@2: @Adt1; // local
18-
let e0@3: @Adt2; // local
19-
let s1@4: @Adt1; // local
20-
let b@5: i32; // local
21-
let @6: i32; // anonymous local
22-
let @7: i32; // anonymous local
23-
let @8: i32; // anonymous local
24-
let a@9: i32; // local
25-
let b@10: i32; // local
26-
match e@1 {
27-
0 => {
28-
s@2 := move ((e@1 as variant @0).0)
29-
e0@3 := move ((e@1 as variant @0).1)
30-
match e0@3 {
31-
0 => {
32-
s1@4 := move ((e0@3 as variant @0).0)
33-
b@5 := copy ((e0@3 as variant @0).1)
34-
@6 := copy ((s1@4).a)
35-
@0 := copy (@6) + copy (b@5)
36-
drop @6
37-
drop s1@4
38-
drop e0@3
39-
drop s@2
40-
},
41-
1 => {
42-
@7 := copy ((s@2).a)
43-
@8 := copy ((s@2).b)
44-
@0 := copy (@7) + copy (@8)
45-
drop @8
46-
drop @7
47-
drop e0@3
48-
drop s@2
49-
},
50-
}
51-
},
52-
1 => {
53-
a@9 := copy (((e@1 as variant @1).0).0)
54-
b@10 := copy (((e@1 as variant @1).0).1)
55-
@0 := copy (a@9) + copy (b@10)
56-
},
57-
}
58-
return
59-
}
60-
fn test::main()
61-
{
62-
let @0: (); // return
63-
let s@1: @Adt1; // local
64-
let s0@2: @Adt1; // local
65-
let e@3: @Adt0; // local
66-
let @4: @Adt2; // anonymous local
67-
let i@5: i32; // local
68-
s@1 := @Adt1 { a: const (1 : i32), b: const (2 : i32) }
69-
s0@2 := @Adt1 { a: const (1 : i32), b: const (2 : i32) }
70-
71-
@4 := test::MyEnum0::A { 0: move (s0@2), 1: const (1 : i32) }
72-
e@3 := test::MyEnum::A { 0: move (s@1), 1: move (@4) }
73-
drop @4
74-
i@5 := @Fun0(move (e@3))
75-
drop i@5
76-
@0 := ()
77-
return
78-
}
79-

tests/expected/llbc/struct/expected

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +0,0 @@
1-
struct test::MyStruct =
2-
{
3-
a: i32,
4-
b: bool,
5-
}
6-
7-
fn test::struct_project(@1: @Adt0) -> i32
8-
{
9-
let @0: i32; // return
10-
let s@1: @Adt0; // arg #1
11-
12-
@0 := copy ((s@1).a)
13-
return
14-
}
15-
16-
fn test::main()
17-
{
18-
let @0: (); // return
19-
let s@1: @Adt0; // local
20-
let a@2: i32; // local
21-
22-
s@1 := @Adt0 { a: const (1 : i32), b: const (true) }
23-
a@2 := @Fun0(move (s@1))
24-
drop a@2
25-
@0 := ()
26-
return
27-
}
28-

tests/expected/llbc/tuple/expected

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +0,0 @@
1-
fn test::tuple_add(@1: (i32, i32)) -> i32
2-
{
3-
let @0: i32; // return
4-
let t@1: (i32, i32); // arg #1
5-
let @2: i32; // anonymous local
6-
let @3: i32; // anonymous local
7-
8-
@2 := copy ((t@1).0)
9-
@3 := copy ((t@1).1)
10-
@0 := copy (@2) + copy (@3)
11-
drop @3
12-
drop @2
13-
return
14-
}
15-
16-
fn test::main()
17-
{
18-
let @0: (); // return
19-
let s@1: i32; // local
20-
let @2: (i32, i32); // anonymous local
21-
22-
@2 := (const (1 : i32), const (2 : i32))
23-
s@1 := @Fun0(move (@2))
24-
drop @2
25-
drop s@1
26-
@0 := ()
27-
return
28-
}

0 commit comments

Comments
 (0)