Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7c656bc

Browse files
committed
Rename CodegenContext::create_diag_handler as CodegenContext::create_dcx.
1 parent dea752e commit 7c656bc

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub(crate) fn run_fat(
183183
modules: Vec<FatLtoInput<GccCodegenBackend>>,
184184
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
185185
) -> Result<LtoModuleCodegen<GccCodegenBackend>, FatalError> {
186-
let diag_handler = cgcx.create_diag_handler();
186+
let diag_handler = cgcx.create_dcx();
187187
let lto_data = prepare_lto(cgcx, &diag_handler)?;
188188
/*let symbols_below_threshold =
189189
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub(crate) fn run_fat(
200200
modules: Vec<FatLtoInput<LlvmCodegenBackend>>,
201201
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
202202
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
203-
let diag_handler = cgcx.create_diag_handler();
203+
let diag_handler = cgcx.create_dcx();
204204
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
205205
let symbols_below_threshold =
206206
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
@@ -222,7 +222,7 @@ pub(crate) fn run_thin(
222222
modules: Vec<(String, ThinBuffer)>,
223223
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
224224
) -> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
225-
let diag_handler = cgcx.create_diag_handler();
225+
let diag_handler = cgcx.create_dcx();
226226
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
227227
let symbols_below_threshold =
228228
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
@@ -721,7 +721,7 @@ pub unsafe fn optimize_thin_module(
721721
thin_module: ThinModule<LlvmCodegenBackend>,
722722
cgcx: &CodegenContext<LlvmCodegenBackend>,
723723
) -> Result<ModuleCodegen<ModuleLlvm>, FatalError> {
724-
let diag_handler = cgcx.create_diag_handler();
724+
let diag_handler = cgcx.create_dcx();
725725

726726
let module_name = &thin_module.shared.module_names[thin_module.idx];
727727
let tm_factory_config = TargetMachineFactoryConfig::new(cgcx, module_name.to_str().unwrap());

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
231231
cgcx: &CodegenContext<Self>,
232232
module: &mut ModuleCodegen<Self::Module>,
233233
) -> Result<(), FatalError> {
234-
let diag_handler = cgcx.create_diag_handler();
234+
let diag_handler = cgcx.create_dcx();
235235
back::lto::run_pass_manager(cgcx, &diag_handler, module, false)
236236
}
237237
unsafe fn optimize_thin(

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
359359
}
360360

361361
impl<B: WriteBackendMethods> CodegenContext<B> {
362-
pub fn create_diag_handler(&self) -> DiagCtxt {
362+
pub fn create_dcx(&self) -> DiagCtxt {
363363
DiagCtxt::with_emitter(Box::new(self.diag_emitter.clone()))
364364
}
365365

@@ -825,7 +825,7 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
825825
module: ModuleCodegen<B::Module>,
826826
module_config: &ModuleConfig,
827827
) -> Result<WorkItemResult<B>, FatalError> {
828-
let diag_handler = cgcx.create_diag_handler();
828+
let diag_handler = cgcx.create_dcx();
829829

830830
unsafe {
831831
B::optimize(cgcx, &diag_handler, &module, module_config)?;
@@ -891,11 +891,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
891891
match link_or_copy(&source_file, &output_path) {
892892
Ok(_) => Some(output_path),
893893
Err(error) => {
894-
cgcx.create_diag_handler().emit_err(errors::CopyPathBuf {
895-
source_file,
896-
output_path,
897-
error,
898-
});
894+
cgcx.create_dcx().emit_err(errors::CopyPathBuf { source_file, output_path, error });
899895
None
900896
}
901897
}
@@ -939,7 +935,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
939935
module: ModuleCodegen<B::Module>,
940936
module_config: &ModuleConfig,
941937
) -> Result<WorkItemResult<B>, FatalError> {
942-
let diag_handler = cgcx.create_diag_handler();
938+
let diag_handler = cgcx.create_dcx();
943939

944940
if !cgcx.opts.unstable_opts.combine_cgu
945941
|| module.kind == ModuleKind::Metadata
@@ -1595,7 +1591,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
15951591
let needs_link = mem::take(&mut needs_link);
15961592
if !needs_link.is_empty() {
15971593
assert!(compiled_modules.is_empty());
1598-
let diag_handler = cgcx.create_diag_handler();
1594+
let diag_handler = cgcx.create_dcx();
15991595
let module = B::run_link(&cgcx, &diag_handler, needs_link).map_err(|_| ())?;
16001596
let module = unsafe {
16011597
B::codegen(&cgcx, &diag_handler, module, cgcx.config(ModuleKind::Regular))

0 commit comments

Comments
 (0)