@@ -65,7 +65,9 @@ impl<T> Revocable<T> {
65
65
data : ManuallyDrop :: new ( UnsafeCell :: new ( data) ) ,
66
66
}
67
67
}
68
+ }
68
69
70
+ impl < T : ?Sized > Revocable < T > {
69
71
/// Tries to access the \[revocable\] wrapped object.
70
72
///
71
73
/// Returns `None` if the object has been revoked and is therefore no longer accessible.
@@ -125,12 +127,12 @@ impl<T: ?Sized> Drop for Revocable<T> {
125
127
/// # Invariants
126
128
///
127
129
/// The RCU read-side lock is held while the guard is alive.
128
- pub struct RevocableGuard < ' a , T > {
130
+ pub struct RevocableGuard < ' a , T : ? Sized > {
129
131
data_ref : * const T ,
130
132
_p : PhantomData < & ' a ( ) > ,
131
133
}
132
134
133
- impl < T > RevocableGuard < ' _ , T > {
135
+ impl < T : ? Sized > RevocableGuard < ' _ , T > {
134
136
fn new ( data_ref : * const T ) -> Self {
135
137
// SAFETY: Just an FFI call, there are no further requirements.
136
138
unsafe { bindings:: rcu_read_lock ( ) } ;
@@ -143,14 +145,14 @@ impl<T> RevocableGuard<'_, T> {
143
145
}
144
146
}
145
147
146
- impl < T > Drop for RevocableGuard < ' _ , T > {
148
+ impl < T : ? Sized > Drop for RevocableGuard < ' _ , T > {
147
149
fn drop ( & mut self ) {
148
150
// SAFETY: By the type invariants, we know that we hold the RCU read-side lock.
149
151
unsafe { bindings:: rcu_read_unlock ( ) } ;
150
152
}
151
153
}
152
154
153
- impl < T > Deref for RevocableGuard < ' _ , T > {
155
+ impl < T : ? Sized > Deref for RevocableGuard < ' _ , T > {
154
156
type Target = T ;
155
157
156
158
fn deref ( & self ) -> & Self :: Target {
0 commit comments