-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Migrate rustc_codegen_gcc to SessionDiagnostics #101075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 16 commits into
rust-lang:master
from
ellishg:rustc_codegen_gcc_diagnostics
Sep 30, 2022
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9363f0f
Add RanlibFailure
ellishg 7e00a48
Add LinkageConstOrMutType
ellishg d9aa635
Add UnwindingInlineAsm
ellishg d0b7e71
Add LTONotSupported
ellishg 5e0c53a
Add LayoutSizeOverflow
ellishg 1ce482a
Lint against untranslatable diagnostics in rustc_codegen_gcc
ellishg fb488ad
remove IntoDiagnosticArg impl for Option
ellishg e906ea8
Add wrapper type for ExitCode for use in RanlibFailure
ellishg 6fdfcb3
lint type
ellishg 249e46b
Add monomorphization errors
ellishg 6e22c0a
impl SessionDiagnostic for LayoutError and Spanned<T>
ellishg 5c7e629
rebase and update trait names
ellishg ac97487
fix lifetime error
ellishg d7bee58
remove comment
ellishg 6d01c6d
lint and remove unused diagnostic
ellishg 01439c9
print <signal> when ranlib failed without an exit code
ellishg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg}; | ||
use rustc_macros::Diagnostic; | ||
use rustc_middle::ty::Ty; | ||
use rustc_span::{Span, Symbol}; | ||
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")), | ||
davidtwco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::ranlib_failure)] | ||
pub(crate) struct RanlibFailure { | ||
exit_code: ExitCode, | ||
} | ||
|
||
impl RanlibFailure { | ||
pub fn new(exit_code: Option<i32>) -> Self { | ||
let exit_code = ExitCode{ exit_code }; | ||
RanlibFailure { exit_code } | ||
davidtwco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_basic_integer, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationBasicInteger<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_invalid_float_vector, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationInvalidFloatVector<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub elem_ty: &'a str, | ||
pub vec_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_not_float, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationNotFloat<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_unrecognized, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationUnrecognized { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_expected_signed_unsigned, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationExpectedSignedUnsigned<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub elem_ty: Ty<'a>, | ||
pub vec_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_unsupported_element, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationUnsupportedElement<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_ty: Ty<'a>, | ||
pub elem_ty: Ty<'a>, | ||
pub ret_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_invalid_bitmask, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationInvalidBitmask<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ty: Ty<'a>, | ||
pub expected_int_bits: u64, | ||
pub expected_bytes: u64, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_simd_shuffle, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationSimdShuffle<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_expected_simd, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationExpectedSimd<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub position: &'a str, | ||
pub found_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_mask_type, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationMaskType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_return_length, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationReturnLength<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_len: u64, | ||
pub ret_ty: Ty<'a>, | ||
pub out_len: u64, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_return_length_input_type, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationReturnLengthInputType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_len: u64, | ||
pub in_ty: Ty<'a>, | ||
pub ret_ty: Ty<'a>, | ||
pub out_len: u64, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_return_element, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationReturnElement<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_elem: Ty<'a>, | ||
pub in_ty: Ty<'a>, | ||
pub ret_ty: Ty<'a>, | ||
pub out_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_return_type, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationReturnType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_elem: Ty<'a>, | ||
pub in_ty: Ty<'a>, | ||
pub ret_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_inserted_type, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationInsertedType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_elem: Ty<'a>, | ||
pub in_ty: Ty<'a>, | ||
pub out_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_return_integer_type, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationReturnIntegerType<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub ret_ty: Ty<'a>, | ||
pub out_ty: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_mismatched_lengths, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationMismatchedLengths { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub m_len: u64, | ||
pub v_len: u64, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_unsupported_cast, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationUnsupportedCast<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_ty: Ty<'a>, | ||
pub in_elem: Ty<'a>, | ||
pub ret_ty: Ty<'a>, | ||
pub out_elem: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::invalid_monomorphization_unsupported_operation, code = "E0511")] | ||
pub(crate) struct InvalidMonomorphizationUnsupportedOperation<'a> { | ||
#[primary_span] | ||
pub span: Span, | ||
pub name: Symbol, | ||
pub in_ty: Ty<'a>, | ||
pub in_elem: Ty<'a>, | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::linkage_const_or_mut_type)] | ||
pub(crate) struct LinkageConstOrMutType { | ||
#[primary_span] | ||
pub span: Span | ||
} | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::lto_not_supported)] | ||
pub(crate) struct LTONotSupported; | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(codegen_gcc::unwinding_inline_asm)] | ||
pub(crate) struct UnwindingInlineAsm { | ||
#[primary_span] | ||
pub span: Span | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.