Add RanlibFailure

This commit is contained in:
Ellis Hoag 2022-08-26 19:32:04 -07:00 committed by Antoni Boucher
parent a900ba9163
commit c503d978dc
3 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,8 @@
use std::fs::File;
use std::path::{Path, PathBuf};
use crate::errors::RanlibFailure;
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
use rustc_session::Session;
@ -181,7 +183,7 @@ enum BuilderKind<'a> {
std::process::Command::new("ranlib").arg(output).status().expect("Couldn't run ranlib");
if !status.success() {
self.config.sess.fatal(&format!("Ranlib exited with code {:?}", status.code()));
self.config.sess.emit_fatal(RanlibFailure { exit_code: status.code() });
}
any_members

7
src/errors.rs Normal file
View File

@ -0,0 +1,7 @@
use rustc_macros::SessionDiagnostic;
#[derive(SessionDiagnostic)]
#[diag(codegen_gcc::ranlib_failure)]
pub(crate) struct RanlibFailure {
pub exit_code: Option<i32>
}

View File

@ -26,6 +26,7 @@
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_macros;
extern crate rustc_metadata;
extern crate rustc_middle;
extern crate rustc_session;
@ -52,6 +53,7 @@
mod coverageinfo;
mod debuginfo;
mod declare;
mod errors;
mod int;
mod intrinsic;
mod mono_item;