From 88c48aa1ea44c514ab6e0fe739968055a1a85f85 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Tue, 16 Apr 2019 16:35:16 +0200 Subject: [PATCH] Add comment about top_label safety --- validation/src/func.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/validation/src/func.rs b/validation/src/func.rs index a161df0..f157954 100644 --- a/validation/src/func.rs +++ b/validation/src/func.rs @@ -1212,8 +1212,14 @@ fn pop_label( Ok(()) } +/// Returns the top most frame from the frame stack. +/// +/// # Panics +/// +/// Can be called only when the frame stack is not empty: that is, it is ok to call this function +/// after initialization of the validation and until the validation reached the latest `End` +/// operator. pub fn top_label(frame_stack: &StackWithLimit) -> &BlockFrame { - // TODO: This actually isn't safe. frame_stack .top() .expect("this function can't be called with empty frame stack")