Make CodegenBackend::join_codegen
infallible.
Because they all are, in practice.
This commit is contained in:
parent
cbddf31863
commit
ede99234c4
6 changed files with 12 additions and 14 deletions
|
@ -233,11 +233,11 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||||
ongoing_codegen: Box<dyn Any>,
|
ongoing_codegen: Box<dyn Any>,
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
_outputs: &OutputFilenames,
|
_outputs: &OutputFilenames,
|
||||||
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed> {
|
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
|
||||||
Ok(ongoing_codegen
|
ongoing_codegen
|
||||||
.downcast::<driver::aot::OngoingCodegen>()
|
.downcast::<driver::aot::OngoingCodegen>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.join(sess, self.config.borrow().as_ref().unwrap()))
|
.join(sess, self.config.borrow().as_ref().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link(
|
fn link(
|
||||||
|
|
|
@ -217,13 +217,11 @@ impl CodegenBackend for GccCodegenBackend {
|
||||||
Box::new(res)
|
Box::new(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed> {
|
fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
|
||||||
let (codegen_results, work_products) = ongoing_codegen
|
ongoing_codegen
|
||||||
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
|
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
|
||||||
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
|
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
|
||||||
.join(sess);
|
.join(sess)
|
||||||
|
|
||||||
Ok((codegen_results, work_products))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) -> Result<(), ErrorGuaranteed> {
|
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) -> Result<(), ErrorGuaranteed> {
|
||||||
|
|
|
@ -369,7 +369,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||||
ongoing_codegen: Box<dyn Any>,
|
ongoing_codegen: Box<dyn Any>,
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
outputs: &OutputFilenames,
|
outputs: &OutputFilenames,
|
||||||
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed> {
|
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
|
||||||
let (codegen_results, work_products) = ongoing_codegen
|
let (codegen_results, work_products) = ongoing_codegen
|
||||||
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
|
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
|
||||||
.expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>")
|
.expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>")
|
||||||
|
@ -382,7 +382,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((codegen_results, work_products))
|
(codegen_results, work_products)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link(
|
fn link(
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub trait CodegenBackend {
|
||||||
ongoing_codegen: Box<dyn Any>,
|
ongoing_codegen: Box<dyn Any>,
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
outputs: &OutputFilenames,
|
outputs: &OutputFilenames,
|
||||||
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed>;
|
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>);
|
||||||
|
|
||||||
/// This is called on the returned `CodegenResults` from `join_codegen`
|
/// This is called on the returned `CodegenResults` from `join_codegen`
|
||||||
fn link(
|
fn link(
|
||||||
|
|
|
@ -259,7 +259,7 @@ pub struct Linker {
|
||||||
impl Linker {
|
impl Linker {
|
||||||
pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) -> Result<()> {
|
pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) -> Result<()> {
|
||||||
let (codegen_results, work_products) =
|
let (codegen_results, work_products) =
|
||||||
codegen_backend.join_codegen(self.ongoing_codegen, sess, &self.output_filenames)?;
|
codegen_backend.join_codegen(self.ongoing_codegen, sess, &self.output_filenames);
|
||||||
|
|
||||||
sess.compile_status()?;
|
sess.compile_status()?;
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,11 @@ impl CodegenBackend for TheBackend {
|
||||||
ongoing_codegen: Box<dyn Any>,
|
ongoing_codegen: Box<dyn Any>,
|
||||||
_sess: &Session,
|
_sess: &Session,
|
||||||
_outputs: &OutputFilenames,
|
_outputs: &OutputFilenames,
|
||||||
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed> {
|
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
|
||||||
let codegen_results = ongoing_codegen
|
let codegen_results = ongoing_codegen
|
||||||
.downcast::<CodegenResults>()
|
.downcast::<CodegenResults>()
|
||||||
.expect("in join_codegen: ongoing_codegen is not a CodegenResults");
|
.expect("in join_codegen: ongoing_codegen is not a CodegenResults");
|
||||||
Ok((*codegen_results, FxIndexMap::default()))
|
(*codegen_results, FxIndexMap::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link(
|
fn link(
|
||||||
|
|
Loading…
Add table
Reference in a new issue