Skip to content

Commit bb39cc3

Browse files
committed
Make MutRef more consistent with &mut
1 parent 2e4bb2b commit bb39cc3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libstd/mutable.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,30 @@ impl<T> Mut<T> {
8282

8383
/// Mutably borrows the wrapped value.
8484
///
85-
/// The borrow lasts untile the returned `MutRef` exits scope. The value
85+
/// The borrow lasts untile the returned `RefMut` exits scope. The value
8686
/// cannot be borrowed while this borrow is active.
8787
///
8888
/// Returns `None` if the value is currently borrowed.
89-
pub fn try_borrow_mut<'a>(&'a self) -> Option<MutRef<'a, T>> {
89+
pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
9090
match self.borrow {
9191
UNUSED => unsafe {
9292
let mut_self = self.as_mut();
9393
mut_self.borrow = WRITING;
94-
Some(MutRef { parent: mut_self })
94+
Some(RefMut { parent: mut_self })
9595
},
9696
_ => None
9797
}
9898
}
9999

100100
/// Mutably borrows the wrapped value.
101101
///
102-
/// The borrow lasts untile the returned `MutRef` exits scope. The value
102+
/// The borrow lasts untile the returned `RefMut` exits scope. The value
103103
/// cannot be borrowed while this borrow is active.
104104
///
105105
/// # Failure
106106
///
107107
/// Fails if the value is currently borrowed.
108-
pub fn borrow_mut<'a>(&'a self) -> MutRef<'a, T> {
108+
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
109109
match self.try_borrow_mut() {
110110
Some(ptr) => ptr,
111111
None => fail!("Mut<T> already borrowed")
@@ -179,19 +179,19 @@ impl<'box, T> Ref<'box, T> {
179179
}
180180

181181
/// Wraps a mutable borrowed reference to a value in a `Mut` box.
182-
pub struct MutRef<'box, T> {
182+
pub struct RefMut<'box, T> {
183183
priv parent: &'box mut Mut<T>
184184
}
185185

186186
#[unsafe_destructor]
187-
impl<'box, T> Drop for MutRef<'box, T> {
187+
impl<'box, T> Drop for RefMut<'box, T> {
188188
fn drop(&mut self) {
189189
assert!(self.parent.borrow == WRITING);
190-
unsafe { self.parent.as_mut().borrow = UNUSED; }
190+
self.parent.borrow = UNUSED;
191191
}
192192
}
193193

194-
impl<'box, T> MutRef<'box, T> {
194+
impl<'box, T> RefMut<'box, T> {
195195
/// Retrieve a mutable reference to the stored value.
196196
#[inline]
197197
pub fn get<'a>(&'a mut self) -> &'a mut T {

0 commit comments

Comments
 (0)