Always use G
for EmissionGuarantee
type variables.
That's what is mostly used. This commit changes a few `EM` and `E` and `T` type variables to `G`.
This commit is contained in:
parent
6a95dee395
commit
ed95f397cf
@ -101,9 +101,9 @@ pub(crate) struct DlltoolFailImportLibrary<'a> {
|
|||||||
|
|
||||||
pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
|
pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
|
||||||
|
|
||||||
impl<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for ParseTargetMachineConfig<'_> {
|
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for ParseTargetMachineConfig<'_> {
|
||||||
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, G> {
|
||||||
let diag: DiagnosticBuilder<'_, EM> = self.0.into_diagnostic(handler);
|
let diag: DiagnosticBuilder<'_, G> = self.0.into_diagnostic(handler);
|
||||||
let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message");
|
let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message");
|
||||||
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());
|
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ pub enum LlvmError<'a> {
|
|||||||
|
|
||||||
pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String);
|
pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String);
|
||||||
|
|
||||||
impl<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for WithLlvmError<'_> {
|
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> {
|
||||||
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, G> {
|
||||||
use LlvmError::*;
|
use LlvmError::*;
|
||||||
let msg_with_llvm_err = match &self.0 {
|
let msg_with_llvm_err = match &self.0 {
|
||||||
WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err,
|
WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err,
|
||||||
|
@ -18,18 +18,18 @@
|
|||||||
/// Trait implemented by error types. This should not be implemented manually. Instead, use
|
/// Trait implemented by error types. This should not be implemented manually. Instead, use
|
||||||
/// `#[derive(Diagnostic)]` -- see [rustc_macros::Diagnostic].
|
/// `#[derive(Diagnostic)]` -- see [rustc_macros::Diagnostic].
|
||||||
#[rustc_diagnostic_item = "IntoDiagnostic"]
|
#[rustc_diagnostic_item = "IntoDiagnostic"]
|
||||||
pub trait IntoDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> {
|
pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||||
/// Write out as a diagnostic out of `Handler`.
|
/// Write out as a diagnostic out of `Handler`.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, T>;
|
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T, E> IntoDiagnostic<'a, E> for Spanned<T>
|
impl<'a, T, G> IntoDiagnostic<'a, G> for Spanned<T>
|
||||||
where
|
where
|
||||||
T: IntoDiagnostic<'a, E>,
|
T: IntoDiagnostic<'a, G>,
|
||||||
E: EmissionGuarantee,
|
G: EmissionGuarantee,
|
||||||
{
|
{
|
||||||
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, E> {
|
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G> {
|
||||||
let mut diag = self.node.into_diagnostic(handler);
|
let mut diag = self.node.into_diagnostic(handler);
|
||||||
diag.set_span(self.span);
|
diag.set_span(self.span);
|
||||||
diag
|
diag
|
||||||
|
@ -13,12 +13,12 @@ pub struct FeatureGateError {
|
|||||||
pub explain: DiagnosticMessage,
|
pub explain: DiagnosticMessage,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: EmissionGuarantee> IntoDiagnostic<'a, T> for FeatureGateError {
|
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for FeatureGateError {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn into_diagnostic(
|
fn into_diagnostic(
|
||||||
self,
|
self,
|
||||||
handler: &'a rustc_errors::Handler,
|
handler: &'a rustc_errors::Handler,
|
||||||
) -> rustc_errors::DiagnosticBuilder<'a, T> {
|
) -> rustc_errors::DiagnosticBuilder<'a, G> {
|
||||||
let mut diag = handler.struct_diagnostic(self.explain);
|
let mut diag = handler.struct_diagnostic(self.explain);
|
||||||
diag.set_span(self.span);
|
diag.set_span(self.span);
|
||||||
diag.code(error_code!(E0658));
|
diag.code(error_code!(E0658));
|
||||||
|
Loading…
Reference in New Issue
Block a user