Fixes #1619: Properly bubble up errors when seeing an unexpected type during lowering.

This commit is contained in:
Benjamin Bouvier
2020-04-28 17:40:16 +02:00
parent c9b27b484e
commit 698dc9c401
6 changed files with 45 additions and 32 deletions

View File

@@ -14,12 +14,12 @@ pub fn compile<B: LowerBackend>(
f: &Function,
b: &B,
abi: Box<dyn ABIBody<I = B::MInst>>,
) -> VCode<B::MInst>
) -> CodegenResult<VCode<B::MInst>>
where
B::MInst: ShowWithRRU,
{
// This lowers the CL IR.
let mut vcode = Lower::new(f, abi).lower(b);
let mut vcode = Lower::new(f, abi)?.lower(b)?;
let universe = &B::MInst::reg_universe(vcode.flags());
@@ -62,5 +62,5 @@ where
vcode.show_rru(Some(universe))
);
vcode
Ok(vcode)
}