From f6519c87a4438cce05ff70fd0f4ffb13c44da192 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 12 Sep 2018 16:58:36 -0700 Subject: [PATCH] Improve the assertion failure message for sealing a block twice. --- lib/frontend/src/ssa.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/frontend/src/ssa.rs b/lib/frontend/src/ssa.rs index b15eea172c..f41e6a32c4 100644 --- a/lib/frontend/src/ssa.rs +++ b/lib/frontend/src/ssa.rs @@ -442,14 +442,18 @@ impl SSABuilder { fn seal_one_ebb_header_block(&mut self, ebb: Ebb, func: &mut Function) { let block = self.header_block(ebb); - let (undef_vars, ebb): (Vec<(Variable, Value)>, Ebb) = match self.blocks[block] { + let undef_vars = match self.blocks[block] { BlockData::EbbBody { .. } => panic!("this should not happen"), BlockData::EbbHeader(ref mut data) => { - debug_assert!(!data.sealed); + debug_assert!( + !data.sealed, + "Attempting to seal {} which is already sealed.", + ebb + ); + debug_assert_eq!(ebb, data.ebb); // Extract the undef_variables data from the block so that we // can iterate over it without borrowing the whole builder. - let undef_variables = mem::replace(&mut data.undef_variables, Vec::new()); - (undef_variables, data.ebb) + mem::replace(&mut data.undef_variables, Vec::new()) } };