diff options
| author | bors <bors@rust-lang.org> | 2014-11-25 09:21:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-25 09:21:45 +0000 |
| commit | f6cb58caeedf509cc80dd376bbb2541a0446046b (patch) | |
| tree | 342842df92d03e14065608b8bef510e7b4980b05 /src/libcore | |
| parent | 0c1d853fba0068f9fd34b43a565ded01b199506c (diff) | |
| parent | f1f6c1286f24f6f762a9b195ac678b55d20c9a9b (diff) | |
auto merge of #19149 : alexcrichton/rust/issue-19091, r=aturon
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: https://github.com/rust-lang/rfcs/pull/430 [breaking-change] cc #19091
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index c4d0bec83ea..587bb4cb110 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -256,15 +256,19 @@ impl<T> RefCell<T> { } /// Consumes the `RefCell`, returning the wrapped value. - #[unstable = "may be renamed, depending on global conventions"] - pub fn unwrap(self) -> T { + #[unstable = "recently renamed per RFC 430"] + pub fn into_inner(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()} + unsafe { self.value.into_inner() } } + /// Deprecated, use into_inner() instead + #[deprecated = "renamed to into_inner()"] + pub fn unwrap(self) -> T { self.into_inner() } + /// Attempts to immutably borrow the wrapped value. /// /// The borrow lasts until the returned `Ref` exits scope. Multiple @@ -518,5 +522,9 @@ impl<T> UnsafeCell<T> { #[inline] #[unstable = "conventions around the name `unwrap` are still under \ development"] - pub unsafe fn unwrap(self) -> T { self.value } + pub unsafe fn into_inner(self) -> T { self.value } + + /// Deprecated, use into_inner() instead + #[deprecated = "renamed to into_inner()"] + pub unsafe fn unwrap(self) -> T { self.into_inner() } } |
