diff options
| author | bors <bors@rust-lang.org> | 2023-12-18 06:03:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-18 06:03:53 +0000 |
| commit | cda4736f1eaad8af6f49388baa9b7e480df8e329 (patch) | |
| tree | 42a50495ab069a1198ed0b43bb5c417ec42ff02d /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 8681e077b8afa99d60acf8f8470a012a3ce709a5 (diff) | |
| parent | 1e831e38ce8ba6fc93338247a7963b3a6b33e542 (diff) | |
| download | rust-cda4736f1eaad8af6f49388baa9b7e480df8e329.tar.gz rust-cda4736f1eaad8af6f49388baa9b7e480df8e329.zip | |
Auto merge of #119063 - nnethercote:dcx, r=compiler-errors
Consistent `Handler` naming This PR implements the renaming described in https://github.com/rust-lang/compiler-team/issues/699. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/errors.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index e6e37a02335..671a225259a 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -5,7 +5,7 @@ use std::path::Path; use crate::fluent_generated as fluent; use rustc_data_structures::small_c_str::SmallCStr; use rustc_errors::{ - DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed, FatalError, Handler, IntoDiagnostic, + DiagCtxt, DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed, FatalError, IntoDiagnostic, }; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::Span; @@ -102,13 +102,12 @@ pub(crate) struct DynamicLinkingWithLTO; pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>); impl IntoDiagnostic<'_, FatalError> for ParseTargetMachineConfig<'_> { - fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, FatalError> { - let diag: DiagnosticBuilder<'_, FatalError> = self.0.into_diagnostic(handler); + fn into_diagnostic(self, dcx: &'_ DiagCtxt) -> DiagnosticBuilder<'_, FatalError> { + let diag: DiagnosticBuilder<'_, FatalError> = self.0.into_diagnostic(dcx); let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message"); - let message = handler.eagerly_translate_to_string(message.clone(), diag.args()); + let message = dcx.eagerly_translate_to_string(message.clone(), diag.args()); - let mut diag = - handler.struct_almost_fatal(fluent::codegen_llvm_parse_target_machine_config); + let mut diag = dcx.struct_almost_fatal(fluent::codegen_llvm_parse_target_machine_config); diag.set_arg("error", message); diag } @@ -125,8 +124,8 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> { pub(crate) struct MissingFeatures; impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> { - fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> { - let mut diag = handler.struct_err(fluent::codegen_llvm_target_feature_disable_or_enable); + fn into_diagnostic(self, dcx: &'_ DiagCtxt) -> DiagnosticBuilder<'_, ErrorGuaranteed> { + let mut diag = dcx.struct_err(fluent::codegen_llvm_target_feature_disable_or_enable); if let Some(span) = self.span { diag.set_span(span); }; @@ -185,7 +184,7 @@ pub enum LlvmError<'a> { pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String); impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> { - fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, G> { + fn into_diagnostic(self, dcx: &'_ DiagCtxt) -> DiagnosticBuilder<'_, G> { use LlvmError::*; let msg_with_llvm_err = match &self.0 { WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err, @@ -202,7 +201,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> { PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err, ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err, }; - let mut diag = self.0.into_diagnostic(handler); + let mut diag = self.0.into_diagnostic(dcx); diag.set_primary_message(msg_with_llvm_err); diag.set_arg("llvm_err", self.1); diag |
