Move supports_parallel from CodegenBackend to ExtraBackendMethods

It is only relevant when using cg_ssa for driving compilation.
This commit is contained in:
bjorn3
2025-01-09 18:17:07 +00:00
parent 0fd257d66c
commit 0809b41cd9
2 changed files with 8 additions and 8 deletions

View File

@@ -383,7 +383,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
pub coordinator_send: Sender<Box<dyn Any + Send>>,
/// `true` if the codegen should be run in parallel.
///
/// Depends on [`CodegenBackend::supports_parallel()`] and `-Zno_parallel_backend`.
/// Depends on [`ExtraBackendMethods::supports_parallel()`] and `-Zno_parallel_backend`.
pub parallel: bool,
}

View File

@@ -97,13 +97,6 @@ pub trait CodegenBackend {
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) {
link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs);
}
/// Returns `true` if this backend can be safely called from multiple threads.
///
/// Defaults to `true`.
fn supports_parallel(&self) -> bool {
true
}
}
pub trait ExtraBackendMethods:
@@ -144,4 +137,11 @@ pub trait ExtraBackendMethods:
{
std::thread::Builder::new().name(name).spawn(f)
}
/// Returns `true` if this backend can be safely called from multiple threads.
///
/// Defaults to `true`.
fn supports_parallel(&self) -> bool {
true
}
}