diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 0b7389b20190c..c4d0bec83eaa7 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -258,6 +258,9 @@ impl RefCell { /// Consumes the `RefCell`, returning the wrapped value. #[unstable = "may be renamed, depending on global conventions"] pub fn unwrap(self) -> T { + // Since this function takes `self` (the `RefCell`) by value, the + // compiler statically verifies that it is not currently borrowed. + // Therefore the following assertion is just a `debug_assert!`. debug_assert!(self.borrow.get() == UNUSED); unsafe{self.value.unwrap()} }