Add RanlibFailure
This commit is contained in:
parent
6580010551
commit
9363f0fda5
6 changed files with 24 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use crate::errors::RanlibFailure;
|
||||||
|
|
||||||
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
|
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
|
||||||
std::process::Command::new("ranlib").arg(output).status().expect("Couldn't run ranlib");
|
std::process::Command::new("ranlib").arg(output).status().expect("Couldn't run ranlib");
|
||||||
|
|
||||||
if !status.success() {
|
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
|
any_members
|
||||||
|
|
7
compiler/rustc_codegen_gcc/src/errors.rs
Normal file
7
compiler/rustc_codegen_gcc/src/errors.rs
Normal 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>
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ extern crate rustc_codegen_ssa;
|
||||||
extern crate rustc_data_structures;
|
extern crate rustc_data_structures;
|
||||||
extern crate rustc_errors;
|
extern crate rustc_errors;
|
||||||
extern crate rustc_hir;
|
extern crate rustc_hir;
|
||||||
|
extern crate rustc_macros;
|
||||||
extern crate rustc_metadata;
|
extern crate rustc_metadata;
|
||||||
extern crate rustc_middle;
|
extern crate rustc_middle;
|
||||||
extern crate rustc_session;
|
extern crate rustc_session;
|
||||||
|
@ -50,6 +51,7 @@ mod context;
|
||||||
mod coverageinfo;
|
mod coverageinfo;
|
||||||
mod debuginfo;
|
mod debuginfo;
|
||||||
mod declare;
|
mod declare;
|
||||||
|
mod errors;
|
||||||
mod int;
|
mod int;
|
||||||
mod intrinsic;
|
mod intrinsic;
|
||||||
mod mono_item;
|
mod mono_item;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
codegen_gcc_ranlib_failure =
|
||||||
|
Ranlib exited with code {$exit_code}
|
|
@ -41,6 +41,7 @@ fluent_messages! {
|
||||||
borrowck => "../locales/en-US/borrowck.ftl",
|
borrowck => "../locales/en-US/borrowck.ftl",
|
||||||
builtin_macros => "../locales/en-US/builtin_macros.ftl",
|
builtin_macros => "../locales/en-US/builtin_macros.ftl",
|
||||||
const_eval => "../locales/en-US/const_eval.ftl",
|
const_eval => "../locales/en-US/const_eval.ftl",
|
||||||
|
codegen_gcc => "../locales/en-US/codegen_gcc.ftl",
|
||||||
driver => "../locales/en-US/driver.ftl",
|
driver => "../locales/en-US/driver.ftl",
|
||||||
expand => "../locales/en-US/expand.ftl",
|
expand => "../locales/en-US/expand.ftl",
|
||||||
session => "../locales/en-US/session.ftl",
|
session => "../locales/en-US/session.ftl",
|
||||||
|
|
|
@ -114,6 +114,15 @@ impl IntoDiagnosticArg for char {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: IntoDiagnosticArg> IntoDiagnosticArg for Option<T> {
|
||||||
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||||
|
match self {
|
||||||
|
Some(t) => t.into_diagnostic_arg(),
|
||||||
|
None => DiagnosticArgValue::Str(Cow::Borrowed("None")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoDiagnosticArg for Symbol {
|
impl IntoDiagnosticArg for Symbol {
|
||||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||||
self.to_ident_string().into_diagnostic_arg()
|
self.to_ident_string().into_diagnostic_arg()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue