Rename Handler
as DiagCtxt
.
This commit is contained in:
parent
321b6565a5
commit
cde19c016e
58 changed files with 216 additions and 204 deletions
|
@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::temp_dir::MaybeTempDir;
|
||||
use rustc_errors::{ErrorGuaranteed, Handler};
|
||||
use rustc_errors::{DiagCtxt, ErrorGuaranteed};
|
||||
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_metadata::find_native_static_library;
|
||||
|
@ -52,7 +52,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::process::{ExitStatus, Output, Stdio};
|
||||
use std::{env, fmt, fs, io, mem, str};
|
||||
|
||||
pub fn ensure_removed(diag_handler: &Handler, path: &Path) {
|
||||
pub fn ensure_removed(diag_handler: &DiagCtxt, path: &Path) {
|
||||
if let Err(e) = fs::remove_file(path) {
|
||||
if e.kind() != io::ErrorKind::NotFound {
|
||||
diag_handler.err(format!("failed to remove {}: {}", path.display(), e));
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_data_structures::memmap::Mmap;
|
|||
use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::emitter::Emitter;
|
||||
use rustc_errors::{translation::Translate, DiagnosticId, FatalError, Handler, Level};
|
||||
use rustc_errors::{translation::Translate, DiagCtxt, DiagnosticId, FatalError, Level};
|
||||
use rustc_errors::{DiagnosticMessage, Style};
|
||||
use rustc_fs_util::link_or_copy;
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
|
@ -344,7 +344,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
|
|||
/// how to call the compiler with the same arguments.
|
||||
pub expanded_args: Vec<String>,
|
||||
|
||||
/// Handler to use for diagnostics produced during codegen.
|
||||
/// Emitter to use for diagnostics produced during codegen.
|
||||
pub diag_emitter: SharedEmitter,
|
||||
/// LLVM optimizations for which we want to print remarks.
|
||||
pub remark: Passes,
|
||||
|
@ -359,8 +359,8 @@ pub struct CodegenContext<B: WriteBackendMethods> {
|
|||
}
|
||||
|
||||
impl<B: WriteBackendMethods> CodegenContext<B> {
|
||||
pub fn create_diag_handler(&self) -> Handler {
|
||||
Handler::with_emitter(Box::new(self.diag_emitter.clone()))
|
||||
pub fn create_diag_handler(&self) -> DiagCtxt {
|
||||
DiagCtxt::with_emitter(Box::new(self.diag_emitter.clone()))
|
||||
}
|
||||
|
||||
pub fn config(&self, kind: ModuleKind) -> &ModuleConfig {
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::assert_module_sources::CguReuse;
|
|||
use crate::back::command::Command;
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic,
|
||||
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, IntoDiagnostic,
|
||||
IntoDiagnosticArg,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
|
@ -210,7 +210,7 @@ pub enum LinkRlibError {
|
|||
pub struct ThorinErrorWrapper(pub thorin::Error);
|
||||
|
||||
impl IntoDiagnostic<'_> for ThorinErrorWrapper {
|
||||
fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||
fn into_diagnostic(self, handler: &DiagCtxt) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||
let mut diag;
|
||||
match self.0 {
|
||||
thorin::Error::ReadInput(_) => {
|
||||
|
@ -412,7 +412,7 @@ pub struct LinkingFailed<'a> {
|
|||
}
|
||||
|
||||
impl IntoDiagnostic<'_> for LinkingFailed<'_> {
|
||||
fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||
fn into_diagnostic(self, handler: &DiagCtxt) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
|
||||
let mut diag = handler.struct_err(fluent::codegen_ssa_linking_failed);
|
||||
diag.set_arg("linker_path", format!("{}", self.linker_path.display()));
|
||||
diag.set_arg("exit_status", format!("{}", self.exit_status));
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
|
|||
use crate::back::write::{CodegenContext, FatLtoInput, ModuleConfig};
|
||||
use crate::{CompiledModule, ModuleCodegen};
|
||||
|
||||
use rustc_errors::{FatalError, Handler};
|
||||
use rustc_errors::{DiagCtxt, FatalError};
|
||||
use rustc_middle::dep_graph::WorkProduct;
|
||||
|
||||
pub trait WriteBackendMethods: 'static + Sized + Clone {
|
||||
|
@ -16,7 +16,7 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
|
|||
/// Merge all modules into main_module and returning it
|
||||
fn run_link(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
diag_handler: &Handler,
|
||||
diag_handler: &DiagCtxt,
|
||||
modules: Vec<ModuleCodegen<Self::Module>>,
|
||||
) -> Result<ModuleCodegen<Self::Module>, FatalError>;
|
||||
/// Performs fat LTO by merging all modules into a single one and returning it
|
||||
|
@ -38,7 +38,7 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
|
|||
fn print_statistics(&self);
|
||||
unsafe fn optimize(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
diag_handler: &Handler,
|
||||
diag_handler: &DiagCtxt,
|
||||
module: &ModuleCodegen<Self::Module>,
|
||||
config: &ModuleConfig,
|
||||
) -> Result<(), FatalError>;
|
||||
|
@ -52,7 +52,7 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
|
|||
) -> Result<ModuleCodegen<Self::Module>, FatalError>;
|
||||
unsafe fn codegen(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
diag_handler: &Handler,
|
||||
diag_handler: &DiagCtxt,
|
||||
module: ModuleCodegen<Self::Module>,
|
||||
config: &ModuleConfig,
|
||||
) -> Result<CompiledModule, FatalError>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue