Add comment about top_label safety

This commit is contained in:
Sergey Pepyakin 2019-04-16 16:35:16 +02:00
parent d5a383a442
commit 88c48aa1ea
1 changed files with 7 additions and 1 deletions

View File

@ -1212,8 +1212,14 @@ fn pop_label(
Ok(()) 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>) -> &BlockFrame { pub fn top_label(frame_stack: &StackWithLimit<BlockFrame>) -> &BlockFrame {
// TODO: This actually isn't safe.
frame_stack frame_stack
.top() .top()
.expect("this function can't be called with empty frame stack") .expect("this function can't be called with empty frame stack")