Add LayoutSizeOverflow
This commit is contained in:
parent
d0b7e71918
commit
5e0c53a679
@ -18,6 +18,7 @@
|
||||
use rustc_target::spec::{HasTargetSpec, Target, TlsModel};
|
||||
|
||||
use crate::callee::get_fn;
|
||||
use crate::errors::LayoutSizeOverflow;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FuncSig<'gcc> {
|
||||
@ -477,7 +478,7 @@ impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||
#[inline]
|
||||
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
|
||||
if let LayoutError::SizeOverflow(_) = err {
|
||||
self.sess().span_fatal(span, &err.to_string())
|
||||
self.sess().emit_fatal(LayoutSizeOverflow { span, error: err.to_string() })
|
||||
} else {
|
||||
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
|
||||
}
|
||||
@ -495,7 +496,7 @@ fn handle_fn_abi_err(
|
||||
fn_abi_request: FnAbiRequest<'tcx>,
|
||||
) -> ! {
|
||||
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
|
||||
self.sess().span_fatal(span, &err.to_string())
|
||||
self.sess().emit_fatal(LayoutSizeOverflow { span, error: err.to_string() })
|
||||
} else {
|
||||
match fn_abi_request {
|
||||
FnAbiRequest::OfFnPtr { sig, extra_args } => {
|
||||
|
@ -7,6 +7,14 @@ pub(crate) struct RanlibFailure {
|
||||
pub exit_code: Option<i32>
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(codegen_gcc::layout_size_overflow)]
|
||||
pub(crate) struct LayoutSizeOverflow {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(codegen_gcc::linkage_const_or_mut_type)]
|
||||
pub(crate) struct LinkageConstOrMutType {
|
||||
|
@ -1,6 +1,9 @@
|
||||
codegen_gcc_ranlib_failure =
|
||||
Ranlib exited with code {$exit_code}
|
||||
|
||||
codegen_gcc_layout_size_overflow =
|
||||
{$error}
|
||||
|
||||
codegen_gcc_linkage_const_or_mut_type =
|
||||
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user