Skip to content

Commit 2ffd165

Browse files
committed
Account for changes to RunCompiler::run
rust-lang/rust#133567
1 parent 7cbaa14 commit 2ffd165

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
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: 3 additions & 0 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", "2023-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

0 commit comments

Comments
 (0)