@@ -11,7 +11,7 @@ use core::ptr::NonNull;
1111/// the compiler to follow. A `DormantMutRef` allows you to check borrowing
1212/// yourself, while still expressing its stacked nature, and encapsulating
1313/// the raw pointer code needed to do this without undefined behavior.
14- pub struct DormantMutRef < ' a , T > {
14+ pub ( super ) struct DormantMutRef < ' a , T > {
1515 ptr : NonNull < T > ,
1616 _marker : PhantomData < & ' a mut T > ,
1717}
@@ -23,7 +23,7 @@ impl<'a, T> DormantMutRef<'a, T> {
2323 /// Capture a unique borrow, and immediately reborrow it. For the compiler,
2424 /// the lifetime of the new reference is the same as the lifetime of the
2525 /// original reference, but you promise to use it for a shorter period.
26- pub fn new ( t : & ' a mut T ) -> ( & ' a mut T , Self ) {
26+ pub ( super ) fn new ( t : & ' a mut T ) -> ( & ' a mut T , Self ) {
2727 let ptr = NonNull :: from ( t) ;
2828 // SAFETY: we hold the borrow throughout 'a via `_marker`, and we expose
2929 // only this reference, so it is unique.
@@ -37,7 +37,7 @@ impl<'a, T> DormantMutRef<'a, T> {
3737 ///
3838 /// The reborrow must have ended, i.e., the reference returned by `new` and
3939 /// all pointers and references derived from it, must not be used anymore.
40- pub unsafe fn awaken ( self ) -> & ' a mut T {
40+ pub ( super ) unsafe fn awaken ( self ) -> & ' a mut T {
4141 // SAFETY: our own safety conditions imply this reference is again unique.
4242 unsafe { & mut * self . ptr . as_ptr ( ) }
4343 }
@@ -48,7 +48,7 @@ impl<'a, T> DormantMutRef<'a, T> {
4848 ///
4949 /// The reborrow must have ended, i.e., the reference returned by `new` and
5050 /// all pointers and references derived from it, must not be used anymore.
51- pub unsafe fn reborrow ( & mut self ) -> & ' a mut T {
51+ pub ( super ) unsafe fn reborrow ( & mut self ) -> & ' a mut T {
5252 // SAFETY: our own safety conditions imply this reference is again unique.
5353 unsafe { & mut * self . ptr . as_ptr ( ) }
5454 }
@@ -59,7 +59,7 @@ impl<'a, T> DormantMutRef<'a, T> {
5959 ///
6060 /// The reborrow must have ended, i.e., the reference returned by `new` and
6161 /// all pointers and references derived from it, must not be used anymore.
62- pub unsafe fn reborrow_shared ( & self ) -> & ' a T {
62+ pub ( super ) unsafe fn reborrow_shared ( & self ) -> & ' a T {
6363 // SAFETY: our own safety conditions imply this reference is again unique.
6464 unsafe { & * self . ptr . as_ptr ( ) }
6565 }
0 commit comments