Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for rust-lang/rust#135880 #1501

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ pub fn run<T: AsRef<OsStr>>(args: &[T]) -> Result<()> {
// of the log messages.
log::debug!("{:?}", rustc_args);

#[allow(clippy::unit_arg)]
map_run_compiler_err(rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks).run())
run_compiler(&rustc_args, &mut callbacks)
}

fn sysroot() -> Result<PathBuf> {
Expand Down Expand Up @@ -422,13 +421,31 @@ fn rustc_args<T: AsRef<OsStr>, U: AsRef<str>, V: AsRef<Path>>(
}

#[rustversion::before(2024-12-09)]
fn map_run_compiler_err(result: Result<(), rustc_span::ErrorGuaranteed>) -> Result<()> {
result.map_err(|_| std::process::exit(1))
fn run_compiler(
at_args: &[String],
callbacks: &mut (dyn rustc_driver::Callbacks + Send),
) -> Result<()> {
rustc_driver::RunCompiler::new(at_args, callbacks)
.run()
.map_err(|_| std::process::exit(1))
}

#[rustversion::since(2024-12-09)]
#[rustversion::all(since(2024-12-09), before(2025-01-24))]
#[allow(clippy::unnecessary_wraps)]
const fn map_run_compiler_err((): ()) -> Result<()> {
fn run_compiler(
at_args: &[String],
callbacks: &mut (dyn rustc_driver::Callbacks + Send),
) -> Result<()> {
rustc_driver::RunCompiler::new(at_args, callbacks).run();
Ok(())
}

#[rustversion::since(2025-01-24)]
fn run_compiler(
at_args: &[String],
callbacks: &mut (dyn rustc_driver::Callbacks + Send),
) -> Result<()> {
rustc_driver::run_compiler(at_args, callbacks);
Ok(())
}

Expand Down
3 changes: 3 additions & 0 deletions expensive/tests/boundary_toolchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ use tempfile::tempdir;
// smoelius: Put recent boundaries first, since they're more likely to cause problems.
// smoelius: The relevant PRs and merge commits appear before each boundary.
const BOUNDARIES: &[(&str, &str)] = &[
// https://github.com/rust-lang/rust/pull/135880
// https://github.com/rust-lang/rust/commit/7d31ae7f351b4aa0fcb47d1d22e04c275bef0653
("2025-01-24", "2025-01-25"),
// https://github.com/rust-lang/rust/pull/133567
// https://github.com/rust-lang/rust/commit/d2881e4eb5e0fe1591bfd8e4cab1d5abc3e3a46c
("2024-12-09", "2024-12-10"),
Expand Down
Loading