Skip to content

Commit 590e0d9

Browse files
committed
Rename Handler as DiagCtxt.
1 parent 335e3ec commit 590e0d9

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/back/lto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput};
3030
use rustc_codegen_ssa::traits::*;
3131
use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind};
3232
use rustc_data_structures::memmap::Mmap;
33-
use rustc_errors::{FatalError, Handler};
33+
use rustc_errors::{FatalError, DiagCtxt};
3434
use rustc_hir::def_id::LOCAL_CRATE;
3535
use rustc_middle::dep_graph::WorkProduct;
3636
use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
@@ -61,7 +61,7 @@ struct LtoData {
6161
tmp_path: TempDir,
6262
}
6363

64-
fn prepare_lto(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &Handler) -> Result<LtoData, FatalError> {
64+
fn prepare_lto(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &DiagCtxt) -> Result<LtoData, FatalError> {
6565
let export_threshold = match cgcx.lto {
6666
// We're just doing LTO for our one crate
6767
Lto::ThinLocal => SymbolExportLevel::Rust,
@@ -192,7 +192,7 @@ pub(crate) fn run_fat(
192192
)
193193
}
194194

195-
fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &Handler, modules: Vec<FatLtoInput<GccCodegenBackend>>, cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>, mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>, tmp_path: TempDir,
195+
fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &DiagCtxt, modules: Vec<FatLtoInput<GccCodegenBackend>>, cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>, mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>, tmp_path: TempDir,
196196
//symbols_below_threshold: &[*const libc::c_char],
197197
) -> Result<LtoModuleCodegen<GccCodegenBackend>, FatalError> {
198198
let _timer = cgcx.prof.generic_activity("GCC_fat_lto_build_monolithic_module");

src/back/write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use gccjit::OutputKind;
44
use rustc_codegen_ssa::{CompiledModule, ModuleCodegen};
55
use rustc_codegen_ssa::back::link::ensure_removed;
66
use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, ModuleConfig};
7-
use rustc_errors::Handler;
7+
use rustc_errors::DiagCtxt;
88
use rustc_fs_util::link_or_copy;
99
use rustc_session::config::OutputType;
1010
use rustc_span::fatal_error::FatalError;
@@ -13,7 +13,7 @@ use rustc_target::spec::SplitDebuginfo;
1313
use crate::{GccCodegenBackend, GccContext};
1414
use crate::errors::CopyBitcode;
1515

16-
pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &Handler, module: ModuleCodegen<GccContext>, config: &ModuleConfig) -> Result<CompiledModule, FatalError> {
16+
pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &DiagCtxt, module: ModuleCodegen<GccContext>, config: &ModuleConfig) -> Result<CompiledModule, FatalError> {
1717
let _timer = cgcx.prof.generic_activity_with_arg("GCC_module_codegen", &*module.name);
1818
{
1919
let context = &module.module_llvm.context;
@@ -148,7 +148,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, diag_hand
148148
))
149149
}
150150

151-
pub(crate) fn link(_cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &Handler, mut _modules: Vec<ModuleCodegen<GccContext>>) -> Result<ModuleCodegen<GccContext>, FatalError> {
151+
pub(crate) fn link(_cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &DiagCtxt, mut _modules: Vec<ModuleCodegen<GccContext>>) -> Result<ModuleCodegen<GccContext>, FatalError> {
152152
unimplemented!();
153153
}
154154

src/errors.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_errors::{
2-
DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, IntoDiagnosticArg,
2+
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, IntoDiagnostic,
3+
IntoDiagnosticArg,
34
};
45
use rustc_macros::{Diagnostic, Subdiagnostic};
56
use rustc_span::Span;
@@ -111,7 +112,7 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
111112
pub(crate) struct MissingFeatures;
112113

113114
impl IntoDiagnostic<'_, ErrorGuaranteed> for TargetFeatureDisableOrEnable<'_> {
114-
fn into_diagnostic(self, handler: &'_ Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
115+
fn into_diagnostic(self, handler: &'_ DiagCtxt) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
115116
let mut diag = handler.struct_err(fluent::codegen_gcc_target_feature_disable_or_enable);
116117
if let Some(span) = self.span {
117118
diag.set_span(span);

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul
100100
use rustc_data_structures::fx::FxIndexMap;
101101
use rustc_data_structures::sync::IntoDynSyncSend;
102102
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
103-
use rustc_errors::{ErrorGuaranteed, Handler};
103+
use rustc_errors::{ErrorGuaranteed, DiagCtxt};
104104
use rustc_metadata::EncodedMetadata;
105105
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
106106
use rustc_middle::util::Providers;
@@ -330,7 +330,7 @@ impl WriteBackendMethods for GccCodegenBackend {
330330
unimplemented!()
331331
}
332332

333-
unsafe fn optimize(_cgcx: &CodegenContext<Self>, _diag_handler: &Handler, module: &ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<(), FatalError> {
333+
unsafe fn optimize(_cgcx: &CodegenContext<Self>, _diag_handler: &DiagCtxt, module: &ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<(), FatalError> {
334334
module.module_llvm.context.set_optimization_level(to_gcc_opt_level(config.opt_level));
335335
Ok(())
336336
}
@@ -344,7 +344,7 @@ impl WriteBackendMethods for GccCodegenBackend {
344344
unimplemented!();
345345
}
346346

347-
unsafe fn codegen(cgcx: &CodegenContext<Self>, diag_handler: &Handler, module: ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<CompiledModule, FatalError> {
347+
unsafe fn codegen(cgcx: &CodegenContext<Self>, diag_handler: &DiagCtxt, module: ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<CompiledModule, FatalError> {
348348
back::write::codegen(cgcx, diag_handler, module, config)
349349
}
350350

@@ -356,7 +356,7 @@ impl WriteBackendMethods for GccCodegenBackend {
356356
unimplemented!();
357357
}
358358

359-
fn run_link(cgcx: &CodegenContext<Self>, diag_handler: &Handler, modules: Vec<ModuleCodegen<Self::Module>>) -> Result<ModuleCodegen<Self::Module>, FatalError> {
359+
fn run_link(cgcx: &CodegenContext<Self>, diag_handler: &DiagCtxt, modules: Vec<ModuleCodegen<Self::Module>>) -> Result<ModuleCodegen<Self::Module>, FatalError> {
360360
back::write::link(cgcx, diag_handler, modules)
361361
}
362362
}

0 commit comments

Comments
 (0)