Skip to content

Commit ddc02b0

Browse files
committed
hack cstr is_empty
1 parent d88f979 commit ddc02b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/ffi/c_str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ impl CStr {
536536
pub const fn is_empty(&self) -> bool {
537537
// SAFETY: We know there is at least one byte; for empty strings it
538538
// is the NUL terminator.
539-
(unsafe { self.inner.get_unchecked(0) }) == &0
539+
// FIXME(const-hack): use get_unchecked
540+
unsafe { *self.inner.as_ptr() == 0 }
540541
}
541542

542543
/// Converts this C string to a byte slice.

0 commit comments

Comments
 (0)