@@ -219,12 +219,13 @@ unsafe impl AlwaysRefCounted for File {
219
219
/// must be on the same thread as this file.
220
220
///
221
221
/// [`assume_no_fdget_pos`]: LocalFile::assume_no_fdget_pos
222
+ #[ repr( transparent) ]
222
223
pub struct LocalFile {
223
224
inner : Opaque < bindings:: file > ,
224
225
}
225
226
226
227
// SAFETY: The type invariants guarantee that `LocalFile` is always ref-counted. This implementation
227
- // makes `ARef<File >` own a normal refcount.
228
+ // makes `ARef<LocalFile >` own a normal refcount.
228
229
unsafe impl AlwaysRefCounted for LocalFile {
229
230
#[ inline]
230
231
fn inc_ref ( & self ) {
@@ -235,7 +236,8 @@ unsafe impl AlwaysRefCounted for LocalFile {
235
236
#[ inline]
236
237
unsafe fn dec_ref ( obj : ptr:: NonNull < LocalFile > ) {
237
238
// SAFETY: To call this method, the caller passes us ownership of a normal refcount, so we
238
- // may drop it. The cast is okay since `File` has the same representation as `struct file`.
239
+ // may drop it. The cast is okay since `LocalFile` has the same representation as
240
+ // `struct file`.
239
241
unsafe { bindings:: fput ( obj. cast ( ) . as_ptr ( ) ) }
240
242
}
241
243
}
@@ -273,7 +275,7 @@ impl LocalFile {
273
275
#[ inline]
274
276
pub unsafe fn from_raw_file < ' a > ( ptr : * const bindings:: file ) -> & ' a LocalFile {
275
277
// SAFETY: The caller guarantees that the pointer is not dangling and stays valid for the
276
- // duration of 'a . The cast is okay because `File ` is `repr(transparent)`.
278
+ // duration of `'a` . The cast is okay because `LocalFile ` is `repr(transparent)`.
277
279
//
278
280
// INVARIANT: The caller guarantees that there are no problematic `fdget_pos` calls.
279
281
unsafe { & * ptr. cast ( ) }
@@ -347,7 +349,7 @@ impl File {
347
349
#[ inline]
348
350
pub unsafe fn from_raw_file < ' a > ( ptr : * const bindings:: file ) -> & ' a File {
349
351
// SAFETY: The caller guarantees that the pointer is not dangling and stays valid for the
350
- // duration of 'a . The cast is okay because `File` is `repr(transparent)`.
352
+ // duration of `'a` . The cast is okay because `File` is `repr(transparent)`.
351
353
//
352
354
// INVARIANT: The caller guarantees that there are no problematic `fdget_pos` calls.
353
355
unsafe { & * ptr. cast ( ) }
0 commit comments