Replace unnecessary abort_if_errors
.
Replace `abort_if_errors` calls that are certain to abort -- because we emit an error immediately beforehand -- with `FatalErro.raise()`.
This commit is contained in:
parent
44006444c8
commit
4da67fff61
6 changed files with 13 additions and 23 deletions
|
@ -3,7 +3,7 @@ use rustc_ast::CRATE_NODE_ID;
|
|||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::temp_dir::MaybeTempDir;
|
||||
use rustc_errors::{DiagCtxt, ErrorGuaranteed};
|
||||
use rustc_errors::{DiagCtxt, ErrorGuaranteed, FatalError};
|
||||
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;
|
||||
|
@ -722,10 +722,7 @@ fn link_dwarf_object<'a>(
|
|||
Ok(())
|
||||
}) {
|
||||
Ok(()) => {}
|
||||
Err(e) => {
|
||||
sess.dcx().emit_err(errors::ThorinErrorWrapper(e));
|
||||
sess.dcx().abort_if_errors();
|
||||
}
|
||||
Err(e) => sess.dcx().emit_fatal(errors::ThorinErrorWrapper(e)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1001,7 +998,7 @@ fn link_natively<'a>(
|
|||
sess.dcx().emit_note(errors::CheckInstalledVisualStudio);
|
||||
sess.dcx().emit_note(errors::InsufficientVSCodeProduct);
|
||||
}
|
||||
sess.dcx().abort_if_errors();
|
||||
FatalError.raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -449,10 +449,7 @@ 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);
|
||||
let dcx = cx.tcx().dcx();
|
||||
dcx.emit_err(errors::MultipleMainFunctions { span });
|
||||
dcx.abort_if_errors();
|
||||
bug!();
|
||||
cx.tcx().dcx().emit_fatal(errors::MultipleMainFunctions { span });
|
||||
};
|
||||
|
||||
// `main` should respect same config for frame pointer elimination as rest of code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue