Skip to content

Commit ed95f39

Browse files
committed
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`.
1 parent 6a95dee commit ed95f39

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

compiler/rustc_codegen_llvm/src/errors.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ pub(crate) struct DynamicLinkingWithLTO;
101101

102102
pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
103103

104-
impl<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for ParseTargetMachineConfig<'_> {
105-
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
106-
let diag: DiagnosticBuilder<'_, EM> = self.0.into_diagnostic(handler);
104+
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for ParseTargetMachineConfig<'_> {
105+
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, G> {
106+
let diag: DiagnosticBuilder<'_, G> = self.0.into_diagnostic(handler);
107107
let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message");
108108
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());
109109

@@ -183,8 +183,8 @@ pub enum LlvmError<'a> {
183183

184184
pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String);
185185

186-
impl<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for WithLlvmError<'_> {
187-
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
186+
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> {
187+
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, G> {
188188
use LlvmError::*;
189189
let msg_with_llvm_err = match &self.0 {
190190
WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err,

compiler/rustc_errors/src/diagnostic_builder.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ use std::thread::panicking;
1818
/// Trait implemented by error types. This should not be implemented manually. Instead, use
1919
/// `#[derive(Diagnostic)]` -- see [rustc_macros::Diagnostic].
2020
#[rustc_diagnostic_item = "IntoDiagnostic"]
21-
pub trait IntoDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> {
21+
pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> {
2222
/// Write out as a diagnostic out of `Handler`.
2323
#[must_use]
24-
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, T>;
24+
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G>;
2525
}
2626

27-
impl<'a, T, E> IntoDiagnostic<'a, E> for Spanned<T>
27+
impl<'a, T, G> IntoDiagnostic<'a, G> for Spanned<T>
2828
where
29-
T: IntoDiagnostic<'a, E>,
30-
E: EmissionGuarantee,
29+
T: IntoDiagnostic<'a, G>,
30+
G: EmissionGuarantee,
3131
{
32-
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, E> {
32+
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G> {
3333
let mut diag = self.node.into_diagnostic(handler);
3434
diag.set_span(self.span);
3535
diag

compiler/rustc_session/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ pub struct FeatureGateError {
1313
pub explain: DiagnosticMessage,
1414
}
1515

16-
impl<'a, T: EmissionGuarantee> IntoDiagnostic<'a, T> for FeatureGateError {
16+
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for FeatureGateError {
1717
#[track_caller]
1818
fn into_diagnostic(
1919
self,
2020
handler: &'a rustc_errors::Handler,
21-
) -> rustc_errors::DiagnosticBuilder<'a, T> {
21+
) -> rustc_errors::DiagnosticBuilder<'a, G> {
2222
let mut diag = handler.struct_diagnostic(self.explain);
2323
diag.set_span(self.span);
2424
diag.code(error_code!(E0658));

0 commit comments

Comments
 (0)