Skip to content

Commit 49697ae

Browse files
committed
get rid of __ in field names
1 parent d0126e8 commit 49697ae

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

src/libstd/sync/mutex.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
143143
#[must_use = "if unused the Mutex will immediately unlock"]
144144
#[stable(feature = "rust1", since = "1.0.0")]
145145
pub struct MutexGuard<'a, T: ?Sized + 'a> {
146-
// funny underscores due to how Deref/DerefMut currently work (they
147-
// disregard field privacy).
148-
__lock: &'a Mutex<T>,
149-
__poison: poison::Guard,
146+
lock: &'a Mutex<T>,
147+
poison: poison::Guard,
150148
}
151149

152150
#[stable(feature = "rust1", since = "1.0.0")]
@@ -417,8 +415,8 @@ impl<'mutex, T: ?Sized> MutexGuard<'mutex, T> {
417415
unsafe fn new(lock: &'mutex Mutex<T>) -> LockResult<MutexGuard<'mutex, T>> {
418416
poison::map_result(lock.poison.borrow(), |guard| {
419417
MutexGuard {
420-
__lock: lock,
421-
__poison: guard,
418+
lock: lock,
419+
poison: guard,
422420
}
423421
})
424422
}
@@ -429,14 +427,14 @@ impl<T: ?Sized> Deref for MutexGuard<'_, T> {
429427
type Target = T;
430428

431429
fn deref(&self) -> &T {
432-
unsafe { &*self.__lock.data.get() }
430+
unsafe { &*self.lock.data.get() }
433431
}
434432
}
435433

436434
#[stable(feature = "rust1", since = "1.0.0")]
437435
impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
438436
fn deref_mut(&mut self) -> &mut T {
439-
unsafe { &mut *self.__lock.data.get() }
437+
unsafe { &mut *self.lock.data.get() }
440438
}
441439
}
442440

@@ -445,8 +443,8 @@ impl<T: ?Sized> Drop for MutexGuard<'_, T> {
445443
#[inline]
446444
fn drop(&mut self) {
447445
unsafe {
448-
self.__lock.poison.done(&self.__poison);
449-
self.__lock.inner.raw_unlock();
446+
self.lock.poison.done(&self.poison);
447+
self.lock.inner.raw_unlock();
450448
}
451449
}
452450
}
@@ -466,11 +464,11 @@ impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> {
466464
}
467465

468466
pub fn guard_lock<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a sys::Mutex {
469-
&guard.__lock.inner
467+
&guard.lock.inner
470468
}
471469

472470
pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Flag {
473-
&guard.__lock.poison
471+
&guard.lock.poison
474472
}
475473

476474
#[cfg(all(test, not(target_os = "emscripten")))]

src/libstd/sync/rwlock.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
8787
#[must_use = "if unused the RwLock will immediately unlock"]
8888
#[stable(feature = "rust1", since = "1.0.0")]
8989
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
90-
__lock: &'a RwLock<T>,
90+
lock: &'a RwLock<T>,
9191
}
9292

9393
#[stable(feature = "rust1", since = "1.0.0")]
@@ -108,8 +108,8 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
108108
#[must_use = "if unused the RwLock will immediately unlock"]
109109
#[stable(feature = "rust1", since = "1.0.0")]
110110
pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
111-
__lock: &'a RwLock<T>,
112-
__poison: poison::Guard,
111+
lock: &'a RwLock<T>,
112+
poison: poison::Guard,
113113
}
114114

115115
#[stable(feature = "rust1", since = "1.0.0")]
@@ -465,7 +465,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
465465
-> LockResult<RwLockReadGuard<'rwlock, T>> {
466466
poison::map_result(lock.poison.borrow(), |_| {
467467
RwLockReadGuard {
468-
__lock: lock,
468+
lock: lock,
469469
}
470470
})
471471
}
@@ -476,8 +476,8 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
476476
-> LockResult<RwLockWriteGuard<'rwlock, T>> {
477477
poison::map_result(lock.poison.borrow(), |guard| {
478478
RwLockWriteGuard {
479-
__lock: lock,
480-
__poison: guard,
479+
lock: lock,
480+
poison: guard,
481481
}
482482
})
483483
}
@@ -487,7 +487,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
487487
impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> {
488488
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
489489
f.debug_struct("RwLockReadGuard")
490-
.field("lock", &self.__lock)
490+
.field("lock", &self.lock)
491491
.finish()
492492
}
493493
}
@@ -503,7 +503,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'_, T> {
503503
impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> {
504504
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
505505
f.debug_struct("RwLockWriteGuard")
506-
.field("lock", &self.__lock)
506+
.field("lock", &self.lock)
507507
.finish()
508508
}
509509
}
@@ -520,7 +520,7 @@ impl<T: ?Sized> Deref for RwLockReadGuard<'_, T> {
520520
type Target = T;
521521

522522
fn deref(&self) -> &T {
523-
unsafe { &*self.__lock.data.get() }
523+
unsafe { &*self.lock.data.get() }
524524
}
525525
}
526526

@@ -529,29 +529,29 @@ impl<T: ?Sized> Deref for RwLockWriteGuard<'_, T> {
529529
type Target = T;
530530

531531
fn deref(&self) -> &T {
532-
unsafe { &*self.__lock.data.get() }
532+
unsafe { &*self.lock.data.get() }
533533
}
534534
}
535535

536536
#[stable(feature = "rust1", since = "1.0.0")]
537537
impl<T: ?Sized> DerefMut for RwLockWriteGuard<'_, T> {
538538
fn deref_mut(&mut self) -> &mut T {
539-
unsafe { &mut *self.__lock.data.get() }
539+
unsafe { &mut *self.lock.data.get() }
540540
}
541541
}
542542

543543
#[stable(feature = "rust1", since = "1.0.0")]
544544
impl<T: ?Sized> Drop for RwLockReadGuard<'_, T> {
545545
fn drop(&mut self) {
546-
unsafe { self.__lock.inner.read_unlock(); }
546+
unsafe { self.lock.inner.read_unlock(); }
547547
}
548548
}
549549

550550
#[stable(feature = "rust1", since = "1.0.0")]
551551
impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> {
552552
fn drop(&mut self) {
553-
self.__lock.poison.done(&self.__poison);
554-
unsafe { self.__lock.inner.write_unlock(); }
553+
self.lock.poison.done(&self.poison);
554+
unsafe { self.lock.inner.write_unlock(); }
555555
}
556556
}
557557

0 commit comments

Comments
 (0)