Skip to content

Commit d91dff3

Browse files
promote debug_assert to assert
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 1603a70 commit d91dff3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

library/std/src/sys/unix/fs.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,11 @@ impl Iterator for ReadDir {
687687
impl Drop for Dir {
688688
fn drop(&mut self) {
689689
let r = unsafe { libc::closedir(self.0) };
690-
debug_assert_eq!(r, 0);
690+
assert!(
691+
r == 0 || crate::io::Error::last_os_error().kind() == crate::io::ErrorKind::Interrupted,
692+
"unexpected error during closedir: {:?}",
693+
crate::io::Error::last_os_error()
694+
);
691695
}
692696
}
693697

library/std/src/sys/unix/locks/pthread_condvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl Condvar {
172172
let mut sys_now = libc::timeval { tv_sec: 0, tv_usec: 0 };
173173
let stable_now = Instant::now();
174174
let r = libc::gettimeofday(&mut sys_now, ptr::null_mut());
175-
debug_assert_eq!(r, 0);
175+
assert_eq!(r, 0, "unexpected error: {:?}", crate::io::Error::last_os_error());
176176

177177
let nsec = dur.subsec_nanos() as libc::c_long + (sys_now.tv_usec * 1000) as libc::c_long;
178178
let extra = (nsec / 1_000_000_000) as libc::time_t;

0 commit comments

Comments
 (0)