Sync from rust 3f28fe133475ec5faf3413b556bf3cfb0d51336c

This commit is contained in:
bjorn3 2023-12-19 12:29:54 +00:00
commit 4a1466ad7a
4 changed files with 7 additions and 8 deletions

View File

@ -176,10 +176,10 @@ pub(crate) fn compile_fn(
match module.define_function(codegened_func.func_id, context) { match module.define_function(codegened_func.func_id, context) {
Ok(()) => {} Ok(()) => {}
Err(ModuleError::Compilation(CodegenError::ImplLimitExceeded)) => { Err(ModuleError::Compilation(CodegenError::ImplLimitExceeded)) => {
let handler = rustc_session::EarlyErrorHandler::new( let early_dcx = rustc_session::EarlyDiagCtxt::new(
rustc_session::config::ErrorOutputType::default(), rustc_session::config::ErrorOutputType::default(),
); );
handler.early_error(format!( early_dcx.early_error(format!(
"backend implementation limit exceeded while compiling {name}", "backend implementation limit exceeded while compiling {name}",
name = codegened_func.symbol_name name = codegened_func.symbol_name
)); ));

View File

@ -46,7 +46,7 @@ impl ConcurrencyLimiter {
} }
} }
pub(super) fn acquire(&mut self, handler: &rustc_errors::Handler) -> ConcurrencyLimiterToken { pub(super) fn acquire(&mut self, dcx: &rustc_errors::DiagCtxt) -> ConcurrencyLimiterToken {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
loop { loop {
state.assert_invariants(); state.assert_invariants();
@ -64,7 +64,7 @@ impl ConcurrencyLimiter {
// Make sure to drop the mutex guard first to prevent poisoning the mutex. // Make sure to drop the mutex guard first to prevent poisoning the mutex.
drop(state); drop(state);
if let Some(err) = err { if let Some(err) = err {
handler.fatal(err); dcx.fatal(err);
} else { } else {
// The error was already emitted, but compilation continued. Raise a silent // The error was already emitted, but compilation continued. Raise a silent
// fatal error. // fatal error.

View File

@ -422,7 +422,7 @@ pub(crate) fn run_aot(
backend_config.clone(), backend_config.clone(),
global_asm_config.clone(), global_asm_config.clone(),
cgu.name(), cgu.name(),
concurrency_limiter.acquire(tcx.sess.diagnostic()), concurrency_limiter.acquire(tcx.sess.dcx()),
), ),
module_codegen, module_codegen,
Some(rustc_middle::dep_graph::hash_result), Some(rustc_middle::dep_graph::hash_result),

View File

@ -231,9 +231,8 @@ pub(crate) fn write_ir_file(
let res = std::fs::File::create(clif_file_name).and_then(|mut file| write(&mut file)); let res = std::fs::File::create(clif_file_name).and_then(|mut file| write(&mut file));
if let Err(err) = res { if let Err(err) = res {
// Using early_warn as no Session is available here // Using early_warn as no Session is available here
let handler = rustc_session::EarlyErrorHandler::new( let handler =
rustc_session::config::ErrorOutputType::default(), rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default());
);
handler.early_warn(format!("error writing ir file: {}", err)); handler.early_warn(format!("error writing ir file: {}", err));
} }
} }