Nicer panic when trying to insert instruction before calling switch_to_block

This commit is contained in:
bjorn3
2018-12-24 15:02:38 +01:00
committed by Dan Gohman
parent 46d9a3cd1a
commit 95118e7244

View File

@@ -367,7 +367,8 @@ impl<'a> FunctionBuilder<'a> {
/// Returns an object with the [`InstBuilder`](../codegen/ir/builder/trait.InstBuilder.html)
/// trait that allows to conveniently append an instruction to the current `Ebb` being built.
pub fn ins<'short>(&'short mut self) -> FuncInstBuilder<'short, 'a> {
let ebb = self.position.ebb.unwrap();
let ebb = self.position.ebb
.expect("Please call switch_to_block before inserting instructions");
FuncInstBuilder::new(self, ebb)
}