Merge pull request #2400 from MattX/improve-finalize-msg

Specify unsealed / unfilled blocks
This commit is contained in:
Nick Fitzgerald
2020-11-23 08:45:08 -08:00
committed by GitHub

View File

@@ -459,19 +459,21 @@ impl<'a> FunctionBuilder<'a> {
/// for another function. /// for another function.
pub fn finalize(&mut self) { pub fn finalize(&mut self) {
// Check that all the `Block`s are filled and sealed. // Check that all the `Block`s are filled and sealed.
debug_assert!( #[cfg(debug_assertions)]
self.func_ctx.blocks.iter().all( {
|(block, block_data)| block_data.pristine || self.func_ctx.ssa.is_sealed(block) for (block, block_data) in self.func_ctx.blocks.iter() {
), assert!(
"all blocks should be sealed before dropping a FunctionBuilder" block_data.pristine || self.func_ctx.ssa.is_sealed(block),
); "FunctionBuilder finalized, but block {} is not sealed",
debug_assert!( block,
self.func_ctx );
.blocks assert!(
.values() block_data.pristine || block_data.filled,
.all(|block_data| block_data.pristine || block_data.filled), "FunctionBuilder finalized, but block {} is not filled",
"all blocks should be filled before dropping a FunctionBuilder" block,
); );
}
}
// In debug mode, check that all blocks are valid basic blocks. // In debug mode, check that all blocks are valid basic blocks.
#[cfg(debug_assertions)] #[cfg(debug_assertions)]