Rename some arguments.
`sess` is a terribly misleading name for a `Handler`! This confused me for a bit.
This commit is contained in:
parent
ab640ca86b
commit
6a95dee395
@ -111,8 +111,8 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
|
|||||||
pub(crate) struct MissingFeatures;
|
pub(crate) struct MissingFeatures;
|
||||||
|
|
||||||
impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> {
|
impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> {
|
||||||
fn into_diagnostic(self, sess: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||||
let mut diag = sess.struct_err(fluent::codegen_gcc_target_feature_disable_or_enable);
|
let mut diag = handler.struct_err(fluent::codegen_gcc_target_feature_disable_or_enable);
|
||||||
if let Some(span) = self.span {
|
if let Some(span) = self.span {
|
||||||
diag.set_span(span);
|
diag.set_span(span);
|
||||||
};
|
};
|
||||||
|
@ -102,12 +102,12 @@ 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<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for ParseTargetMachineConfig<'_> {
|
||||||
fn into_diagnostic(self, sess: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
||||||
let diag: DiagnosticBuilder<'_, EM> = self.0.into_diagnostic(sess);
|
let diag: DiagnosticBuilder<'_, EM> = 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 = sess.eagerly_translate_to_string(message.clone(), diag.args());
|
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());
|
||||||
|
|
||||||
let mut diag = sess.struct_diagnostic(fluent::codegen_llvm_parse_target_machine_config);
|
let mut diag = handler.struct_diagnostic(fluent::codegen_llvm_parse_target_machine_config);
|
||||||
diag.set_arg("error", message);
|
diag.set_arg("error", message);
|
||||||
diag
|
diag
|
||||||
}
|
}
|
||||||
@ -124,8 +124,8 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
|
|||||||
pub(crate) struct MissingFeatures;
|
pub(crate) struct MissingFeatures;
|
||||||
|
|
||||||
impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> {
|
impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> {
|
||||||
fn into_diagnostic(self, sess: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||||
let mut diag = sess.struct_err(fluent::codegen_llvm_target_feature_disable_or_enable);
|
let mut diag = handler.struct_err(fluent::codegen_llvm_target_feature_disable_or_enable);
|
||||||
if let Some(span) = self.span {
|
if let Some(span) = self.span {
|
||||||
diag.set_span(span);
|
diag.set_span(span);
|
||||||
};
|
};
|
||||||
@ -184,7 +184,7 @@ 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<EM: EmissionGuarantee> IntoDiagnostic<'_, EM> for WithLlvmError<'_> {
|
||||||
fn into_diagnostic(self, sess: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
||||||
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,
|
||||||
@ -201,7 +201,7 @@ fn into_diagnostic(self, sess: &'_ Handler) -> DiagnosticBuilder<'_, EM> {
|
|||||||
PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err,
|
PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err,
|
||||||
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
|
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
|
||||||
};
|
};
|
||||||
let mut diag = self.0.into_diagnostic(sess);
|
let mut diag = self.0.into_diagnostic(handler);
|
||||||
diag.set_primary_message(msg_with_llvm_err);
|
diag.set_primary_message(msg_with_llvm_err);
|
||||||
diag.set_arg("llvm_err", self.1);
|
diag.set_arg("llvm_err", self.1);
|
||||||
diag
|
diag
|
||||||
|
Loading…
Reference in New Issue
Block a user