2022-08-31 22:02:35 -07:00
|
|
|
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
|
2022-08-26 19:32:04 -07:00
|
|
|
use rustc_macros::SessionDiagnostic;
|
2022-08-26 20:23:50 -07:00
|
|
|
use rustc_span::Span;
|
2022-08-31 22:02:35 -07:00
|
|
|
use std::borrow::Cow;
|
|
|
|
|
|
|
|
struct ExitCode {
|
|
|
|
pub exit_code: Option<i32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl IntoDiagnosticArg for ExitCode {
|
|
|
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
|
|
|
match self.exit_code {
|
|
|
|
Some(t) => t.into_diagnostic_arg(),
|
|
|
|
None => DiagnosticArgValue::Str(Cow::Borrowed("None")),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 19:32:04 -07:00
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_gcc::ranlib_failure)]
|
|
|
|
pub(crate) struct RanlibFailure {
|
2022-08-31 22:02:35 -07:00
|
|
|
exit_code: ExitCode,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl RanlibFailure {
|
|
|
|
pub fn new(exit_code: Option<i32>) -> Self {
|
|
|
|
let exit_code = ExitCode{ exit_code };
|
|
|
|
RanlibFailure { exit_code }
|
|
|
|
}
|
2022-08-26 19:32:04 -07:00
|
|
|
}
|
2022-08-26 20:23:50 -07:00
|
|
|
|
2022-08-27 15:19:16 -07:00
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_gcc::layout_size_overflow)]
|
|
|
|
pub(crate) struct LayoutSizeOverflow {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub error: String,
|
|
|
|
}
|
|
|
|
|
2022-08-26 20:23:50 -07:00
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_gcc::linkage_const_or_mut_type)]
|
|
|
|
pub(crate) struct LinkageConstOrMutType {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span
|
|
|
|
}
|
2022-08-26 20:44:44 -07:00
|
|
|
|
2022-08-26 20:50:37 -07:00
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_gcc::lto_not_supported)]
|
2022-08-31 22:03:05 -07:00
|
|
|
pub(crate) struct LTONotSupported;
|
2022-08-26 20:50:37 -07:00
|
|
|
|
2022-08-26 20:44:44 -07:00
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_gcc::unwinding_inline_asm)]
|
|
|
|
pub(crate) struct UnwindingInlineAsm {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span
|
|
|
|
}
|