We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bf06ce commit 41f345dCopy full SHA for 41f345d
src/fs/file.rs
@@ -419,7 +419,11 @@ cfg_if! {
419
420
impl IntoRawFd for File {
421
fn into_raw_fd(self) -> RawFd {
422
- self.file.as_raw_fd()
+ let file = self.file.clone();
423
+ drop(self);
424
+ Arc::try_unwrap(file)
425
+ .expect("cannot acquire ownership of file handle after drop")
426
+ .into_raw_fd()
427
}
428
429
@@ -442,7 +446,11 @@ cfg_if! {
442
446
443
447
impl IntoRawHandle for File {
444
448
fn into_raw_handle(self) -> RawHandle {
445
- self.file.as_raw_handle()
449
450
451
452
+ .expect("cannot acquire ownership of file's handle after drop")
453
+ .into_raw_handle()
454
455
456
0 commit comments