diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-21 16:26:09 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-24 08:17:47 +1100 |
| commit | 8a9db2545919f945ffbb215e4325917e0bfc5b3a (patch) | |
| tree | 435bcdd5e90f99b23e52f76535996e27c42ccf06 /compiler/rustc_codegen_ssa/src | |
| parent | 8af3d8dcabc8970615dd386df7fde13c5794f004 (diff) | |
| download | rust-8a9db2545919f945ffbb215e4325917e0bfc5b3a.tar.gz rust-8a9db2545919f945ffbb215e4325917e0bfc5b3a.zip | |
Remove more `Session` methods that duplicate `DiagCtxt` methods.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 7 |
3 files changed, 11 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index ae64b8ca588..4ff497f2fdd 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -716,7 +716,7 @@ fn link_dwarf_object<'a>( Ok(()) => {} Err(e) => { sess.dcx().emit_err(errors::ThorinErrorWrapper(e)); - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); } } } @@ -765,7 +765,7 @@ fn link_natively<'a>( } // May have not found libraries in the right formats. - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); // Invoke the system linker info!("{:?}", &cmd); @@ -970,7 +970,7 @@ fn link_natively<'a>( } } - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); } info!("linker stderr:\n{}", escape_string(&prog.stderr)); info!("linker stdout:\n{}", escape_string(&prog.stdout)); @@ -993,7 +993,7 @@ fn link_natively<'a>( sess.dcx().emit_note(errors::CheckInstalledVisualStudio); sess.dcx().emit_note(errors::InsufficientVSCodeProduct); } - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); } } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index f7eda81da29..5a8db7bbf2d 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1883,7 +1883,7 @@ impl SharedEmitterMain { err.emit(); } Ok(SharedEmitterMessage::AbortIfErrors) => { - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); } Ok(SharedEmitterMessage::Fatal(msg)) => { sess.dcx().fatal(msg); @@ -1939,7 +1939,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> { let compiled_modules = sess.time("join_worker_thread", || match self.coordinator.join() { Ok(Ok(compiled_modules)) => compiled_modules, Ok(Err(())) => { - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); panic!("expected abort due to worker thread errors") } Err(_) => { @@ -1947,7 +1947,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> { } }); - sess.abort_if_errors(); + sess.dcx().abort_if_errors(); let work_products = copy_all_cgu_workproducts_to_incr_comp_cache_dir(sess, &compiled_modules); diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 1367e038492..9d1729c4b54 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -448,8 +448,9 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let Some(llfn) = cx.declare_c_main(llfty) else { // FIXME: We should be smart and show a better diagnostic here. let span = cx.tcx().def_span(rust_main_def_id); - cx.sess().dcx().emit_err(errors::MultipleMainFunctions { span }); - cx.sess().abort_if_errors(); + let dcx = cx.tcx().dcx(); + dcx.emit_err(errors::MultipleMainFunctions { span }); + dcx.abort_if_errors(); bug!(); }; @@ -752,7 +753,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>( // This will unwind if there are errors, which triggers our `AbortCodegenOnDrop` // guard. Unfortunately, just skipping the `submit_codegened_module_to_llvm` makes // compilation hang on post-monomorphization errors. - tcx.sess.abort_if_errors(); + tcx.dcx().abort_if_errors(); submit_codegened_module_to_llvm( &backend, |
