mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Add LayoutSizeOverflow
This commit is contained in:
parent
4a861c140a
commit
1b5dd4bf5e
@ -19,6 +19,7 @@ use rustc_target::abi::{call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDat
|
|||||||
use rustc_target::spec::{HasTargetSpec, Target, TlsModel};
|
use rustc_target::spec::{HasTargetSpec, Target, TlsModel};
|
||||||
|
|
||||||
use crate::callee::get_fn;
|
use crate::callee::get_fn;
|
||||||
|
use crate::errors::LayoutSizeOverflow;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FuncSig<'gcc> {
|
pub struct FuncSig<'gcc> {
|
||||||
@ -492,7 +493,7 @@ impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
|
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
|
||||||
if let LayoutError::SizeOverflow(_) = err {
|
if let LayoutError::SizeOverflow(_) = err {
|
||||||
self.sess().span_fatal(span, &err.to_string())
|
self.sess().emit_fatal(LayoutSizeOverflow { span, error: err.to_string() })
|
||||||
} else {
|
} else {
|
||||||
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
|
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
|
||||||
}
|
}
|
||||||
@ -510,7 +511,7 @@ impl<'gcc, 'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||||||
fn_abi_request: FnAbiRequest<'tcx>,
|
fn_abi_request: FnAbiRequest<'tcx>,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
|
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 {
|
} else {
|
||||||
match fn_abi_request {
|
match fn_abi_request {
|
||||||
FnAbiRequest::OfFnPtr { sig, extra_args } => {
|
FnAbiRequest::OfFnPtr { sig, extra_args } => {
|
||||||
|
@ -7,6 +7,14 @@ pub(crate) struct RanlibFailure {
|
|||||||
pub exit_code: Option<i32>
|
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)]
|
#[derive(SessionDiagnostic)]
|
||||||
#[diag(codegen_gcc::linkage_const_or_mut_type)]
|
#[diag(codegen_gcc::linkage_const_or_mut_type)]
|
||||||
pub(crate) struct LinkageConstOrMutType {
|
pub(crate) struct LinkageConstOrMutType {
|
||||||
|
Loading…
Reference in New Issue
Block a user