File tree 2 files changed +8
-10
lines changed
2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -243,13 +243,12 @@ impl Drop for MmapInner {
243
243
let alignment = self . ptr as usize % page_size ( ) ;
244
244
let len = self . len + alignment;
245
245
let len = len. max ( 1 ) ;
246
+ // Any errors during unmapping/closing are ignored as the only way
247
+ // to report them would be through panicking which is highly discouraged
248
+ // in Drop impls, c.f. https://github.com/rust-lang/lang-team/issues/97
246
249
unsafe {
247
250
let ptr = self . ptr . offset ( -( alignment as isize ) ) ;
248
- assert ! (
249
- libc:: munmap( ptr, len as libc:: size_t) == 0 ,
250
- "unable to unmap mmap: {}" ,
251
- io:: Error :: last_os_error( )
252
- ) ;
251
+ libc:: munmap ( ptr, len as libc:: size_t ) ;
253
252
}
254
253
}
255
254
}
Original file line number Diff line number Diff line change @@ -489,13 +489,12 @@ impl Drop for MmapInner {
489
489
return ;
490
490
}
491
491
let alignment = self . ptr as usize % allocation_granularity ( ) ;
492
+ // Any errors during unmapping/closing are ignored as the only way
493
+ // to report them would be through panicking which is highly discouraged
494
+ // in Drop impls, c.f. https://github.com/rust-lang/lang-team/issues/97
492
495
unsafe {
493
496
let ptr = self . ptr . offset ( -( alignment as isize ) ) ;
494
- assert ! (
495
- UnmapViewOfFile ( ptr) != 0 ,
496
- "unable to unmap mmap: {}" ,
497
- io:: Error :: last_os_error( )
498
- ) ;
497
+ UnmapViewOfFile ( ptr) ;
499
498
500
499
if let Some ( handle) = self . handle {
501
500
CloseHandle ( handle) ;
You can’t perform that action at this time.
0 commit comments