@@ -350,8 +350,7 @@ pub fn run<T: AsRef<OsStr>>(args: &[T]) -> Result<()> {
350350 // of the log messages.
351351 log:: debug!( "{:?}" , rustc_args) ;
352352
353- #[ allow( clippy:: unit_arg) ]
354- map_run_compiler_err ( rustc_driver:: RunCompiler :: new ( & rustc_args, & mut callbacks) . run ( ) )
353+ run_compiler ( & rustc_args, & mut callbacks)
355354}
356355
357356fn sysroot ( ) -> Result < PathBuf > {
@@ -422,13 +421,31 @@ fn rustc_args<T: AsRef<OsStr>, U: AsRef<str>, V: AsRef<Path>>(
422421}
423422
424423#[ rustversion:: before( 2024 -12 -09 ) ]
425- fn map_run_compiler_err ( result : Result < ( ) , rustc_span:: ErrorGuaranteed > ) -> Result < ( ) > {
426- result. map_err ( |_| std:: process:: exit ( 1 ) )
424+ fn run_compiler (
425+ at_args : & [ String ] ,
426+ callbacks : & mut ( dyn rustc_driver:: Callbacks + Send ) ,
427+ ) -> Result < ( ) > {
428+ rustc_driver:: RunCompiler :: new ( at_args, callbacks)
429+ . run ( )
430+ . map_err ( |_| std:: process:: exit ( 1 ) )
427431}
428432
429- #[ rustversion:: since( 2024 -12 -09 ) ]
433+ #[ rustversion:: all ( since( 2024 -12 -09 ) , before ( 2025 - 01 - 24 ) ) ]
430434#[ allow( clippy:: unnecessary_wraps) ]
431- const fn map_run_compiler_err ( ( ) : ( ) ) -> Result < ( ) > {
435+ fn run_compiler (
436+ at_args : & [ String ] ,
437+ callbacks : & mut ( dyn rustc_driver:: Callbacks + Send ) ,
438+ ) -> Result < ( ) > {
439+ rustc_driver:: RunCompiler :: new ( at_args, callbacks) . run ( ) ;
440+ Ok ( ( ) )
441+ }
442+
443+ #[ rustversion:: since( 2025 -01 -24 ) ]
444+ fn run_compiler (
445+ at_args : & [ String ] ,
446+ callbacks : & mut ( dyn rustc_driver:: Callbacks + Send ) ,
447+ ) -> Result < ( ) > {
448+ rustc_driver:: run_compiler ( at_args, callbacks) ;
432449 Ok ( ( ) )
433450}
434451
0 commit comments