Skip to content

Commit fcc0677

Browse files
committed
Account for changes to RunCompiler::run
rust-lang/rust#133567
1 parent d417036 commit fcc0677

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

driver/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ pub fn run<T: AsRef<OsStr>>(args: &[T]) -> Result<()> {
350350
// of the log messages.
351351
log::debug!("{:?}", rustc_args);
352352

353-
rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks)
354-
.run()
355-
.map_err(|_| std::process::exit(1))
353+
map_run_compiler_err(rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks).run())
356354
}
357355

358356
fn sysroot() -> Result<PathBuf> {
@@ -422,6 +420,16 @@ fn rustc_args<T: AsRef<OsStr>, U: AsRef<str>, V: AsRef<Path>>(
422420
Ok(rustc_args)
423421
}
424422

423+
#[rustversion::before(2024-12-09)]
424+
fn map_run_compiler_err(result: Result<(), rustc_span::ErrorGuaranteed>) -> Result<()> {
425+
result.map_err(|_| std::process::exit(1))
426+
}
427+
428+
#[rustversion::since(2024-12-09)]
429+
fn map_run_compiler_err((): ()) -> Result<()> {
430+
Ok(())
431+
}
432+
425433
#[expect(clippy::unwrap_used)]
426434
#[cfg(test)]
427435
mod test {

expensive/tests/boundary_toolchains.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ use tempfile::tempdir;
1818
// smoelius: Put recent boundaries first, since they're more likely to cause problems.
1919
// smoelius: The relevant PRs and merge commits appear before each boundary.
2020
const BOUNDARIES: &[(&str, &str)] = &[
21+
// https://github.com/rust-lang/rust/pull/133567
22+
// https://github.com/rust-lang/rust/commit/d2881e4eb5e0fe1591bfd8e4cab1d5abc3e3a46c
23+
("2024-12-09", "2024-12-10"),
2124
// https://github.com/rust-lang/rust/pull/122450
2225
// https://github.com/rust-lang/rust/commit/685927aae69657b46323cffbeb0062835bd7fa2b
2326
// smoelius: `proc-macro2` now requires library features `proc_macro_byte_character` and
@@ -37,18 +40,22 @@ const BOUNDARIES: &[(&str, &str)] = &[
3740
// attributes", which were introduced in Rust 1.78. nightly-2024-02-03 is the latest toolchain
3841
// with minor version 77. nightly-2024-03-09 is the earliest toolchain incorporating the
3942
// diagnostic attributes PR: https://github.com/rust-lang/rust/pull/119888
40-
("2024-02-03", "2024-03-09"),
43+
// smoelius: `cargo-platform v0.1.9` requires rustc 1.78 or newer.
44+
// nightly-2024-02-03 is Rust 1.77.
45+
// ("2024-02-03", "2024-03-09"),
4146
// https://github.com/rust-lang/rust/pull/119146
4247
// https://github.com/rust-lang/rust/commit/2271c26e4a8e062bb00d709d0ccb5846e0c341b9
43-
("2023-12-26", "2023-12-27"),
48+
// ("2023-12-26", "2023-12-27"),
4449
// https://github.com/rust-lang/rust/pull/119171
4550
// https://github.com/rust-lang/rust/commit/e0d7a72c46d554cb63a1f91a523bfc9e6e37d886
46-
("2023-12-23", "2023-12-24"),
51+
// ("2023-12-23", "2023-12-24"),
52+
4753
// smoelius: `rustfix` 0.8.5 (used by `dylint_testing`) requires rustc 1.77 or newer.
4854
// nightly-2023-12-18 is Rust 1.76.
4955
// https://github.com/rust-lang/rust/pull/119063
5056
// https://github.com/rust-lang/rust/commit/cda4736f1eaad8af6f49388baa9b7e480df8e329
5157
// ("2023-12-18", "2023-12-19"),
58+
5259
// smoelius: `cargo-platform v0.1.8` requires rustc 1.73 or newer.
5360
// https://github.com/rust-lang/rust/pull/112692
5461
// https://github.com/rust-lang/rust/commit/b6144cd843d6eb6acc086797ea37e0c69c892b90

0 commit comments

Comments
 (0)