We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cca33c3 + f9f5c03 commit 6df44eaCopy full SHA for 6df44ea
src/libcore/cell.rs
@@ -258,6 +258,9 @@ impl<T> RefCell<T> {
258
/// Consumes the `RefCell`, returning the wrapped value.
259
#[unstable = "may be renamed, depending on global conventions"]
260
pub fn unwrap(self) -> T {
261
+ // Since this function takes `self` (the `RefCell`) by value, the
262
+ // compiler statically verifies that it is not currently borrowed.
263
+ // Therefore the following assertion is just a `debug_assert!`.
264
debug_assert!(self.borrow.get() == UNUSED);
265
unsafe{self.value.unwrap()}
266
}
0 commit comments