We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d88f979 commit ddc02b0Copy full SHA for ddc02b0
library/core/src/ffi/c_str.rs
@@ -536,7 +536,8 @@ impl CStr {
536
pub const fn is_empty(&self) -> bool {
537
// SAFETY: We know there is at least one byte; for empty strings it
538
// is the NUL terminator.
539
- (unsafe { self.inner.get_unchecked(0) }) == &0
+ // FIXME(const-hack): use get_unchecked
540
+ unsafe { *self.inner.as_ptr() == 0 }
541
}
542
543
/// Converts this C string to a byte slice.
0 commit comments