@@ -11,7 +11,7 @@ use core::ptr::NonNull;
11
11
/// the compiler to follow. A `DormantMutRef` allows you to check borrowing
12
12
/// yourself, while still expressing its stacked nature, and encapsulating
13
13
/// the raw pointer code needed to do this without undefined behavior.
14
- pub struct DormantMutRef < ' a , T > {
14
+ pub ( super ) struct DormantMutRef < ' a , T > {
15
15
ptr : NonNull < T > ,
16
16
_marker : PhantomData < & ' a mut T > ,
17
17
}
@@ -23,7 +23,7 @@ impl<'a, T> DormantMutRef<'a, T> {
23
23
/// Capture a unique borrow, and immediately reborrow it. For the compiler,
24
24
/// the lifetime of the new reference is the same as the lifetime of the
25
25
/// 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 ) {
27
27
let ptr = NonNull :: from ( t) ;
28
28
// SAFETY: we hold the borrow throughout 'a via `_marker`, and we expose
29
29
// only this reference, so it is unique.
@@ -37,7 +37,7 @@ impl<'a, T> DormantMutRef<'a, T> {
37
37
///
38
38
/// The reborrow must have ended, i.e., the reference returned by `new` and
39
39
/// 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 {
41
41
// SAFETY: our own safety conditions imply this reference is again unique.
42
42
unsafe { & mut * self . ptr . as_ptr ( ) }
43
43
}
@@ -48,7 +48,7 @@ impl<'a, T> DormantMutRef<'a, T> {
48
48
///
49
49
/// The reborrow must have ended, i.e., the reference returned by `new` and
50
50
/// 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 {
52
52
// SAFETY: our own safety conditions imply this reference is again unique.
53
53
unsafe { & mut * self . ptr . as_ptr ( ) }
54
54
}
@@ -59,7 +59,7 @@ impl<'a, T> DormantMutRef<'a, T> {
59
59
///
60
60
/// The reborrow must have ended, i.e., the reference returned by `new` and
61
61
/// 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 {
63
63
// SAFETY: our own safety conditions imply this reference is again unique.
64
64
unsafe { & * self . ptr . as_ptr ( ) }
65
65
}
0 commit comments