Remove Session
methods that duplicate DiagCtxt
methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
This commit is contained in:
parent
d51db05d7e
commit
99472c7049
298 changed files with 1806 additions and 2064 deletions
|
@ -69,7 +69,7 @@ impl OngoingCodegen {
|
|||
|
||||
let module_codegen_result = match module_codegen_result {
|
||||
Ok(module_codegen_result) => module_codegen_result,
|
||||
Err(err) => sess.fatal(err),
|
||||
Err(err) => sess.dcx().fatal(err),
|
||||
};
|
||||
let ModuleCodegenResult { module_regular, module_global_asm, existing_work_product } =
|
||||
module_codegen_result;
|
||||
|
@ -422,7 +422,7 @@ pub(crate) fn run_aot(
|
|||
backend_config.clone(),
|
||||
global_asm_config.clone(),
|
||||
cgu.name(),
|
||||
concurrency_limiter.acquire(tcx.sess.dcx()),
|
||||
concurrency_limiter.acquire(tcx.dcx()),
|
||||
),
|
||||
module_codegen,
|
||||
Some(rustc_middle::dep_graph::hash_result),
|
||||
|
@ -455,7 +455,7 @@ pub(crate) fn run_aot(
|
|||
"allocator_shim".to_owned(),
|
||||
) {
|
||||
Ok(allocator_module) => Some(allocator_module),
|
||||
Err(err) => tcx.sess.fatal(err),
|
||||
Err(err) => tcx.dcx().fatal(err),
|
||||
}
|
||||
} else {
|
||||
None
|
||||
|
@ -478,7 +478,7 @@ pub(crate) fn run_aot(
|
|||
let obj = create_compressed_metadata_file(tcx.sess, &metadata, &symbol_name);
|
||||
|
||||
if let Err(err) = std::fs::write(&tmp_file, obj) {
|
||||
tcx.sess.fatal(format!("error writing metadata object file: {}", err));
|
||||
tcx.dcx().fatal(format!("error writing metadata object file: {}", err));
|
||||
}
|
||||
|
||||
(metadata_cgu_name, tmp_file)
|
||||
|
|
|
@ -94,11 +94,11 @@ fn create_jit_module(
|
|||
|
||||
pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
tcx.sess.fatal("JIT mode doesn't work with `cargo check`");
|
||||
tcx.dcx().fatal("JIT mode doesn't work with `cargo check`");
|
||||
}
|
||||
|
||||
if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) {
|
||||
tcx.sess.fatal("can't jit non-executable crate");
|
||||
tcx.dcx().fatal("can't jit non-executable crate");
|
||||
}
|
||||
|
||||
let (mut jit_module, mut cx) = create_jit_module(
|
||||
|
@ -141,14 +141,14 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
|
|||
}
|
||||
MonoItem::GlobalAsm(item_id) => {
|
||||
let item = tcx.hir().item(item_id);
|
||||
tcx.sess.span_fatal(item.span, "Global asm is not supported in JIT mode");
|
||||
tcx.dcx().span_fatal(item.span, "Global asm is not supported in JIT mode");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if !cx.global_asm.is_empty() {
|
||||
tcx.sess.fatal("Inline asm is not supported in JIT mode");
|
||||
tcx.dcx().fatal("Inline asm is not supported in JIT mode");
|
||||
}
|
||||
|
||||
tcx.sess.abort_if_errors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue