Skip to content

Commit 5bffb96

Browse files
committed
properly explain why the unsafe is needed and shush the warning in tests
1 parent 9f57cfb commit 5bffb96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,12 @@ impl<T> ThinVec<T> {
15411541

15421542
#[cfg(feature = "gecko-ffi")]
15431543
#[inline]
1544+
#[allow(unused_unsafe)]
15441545
fn is_singleton(&self) -> bool {
1546+
// NOTE: the tests will complain that this "unsafe" isn't needed, but it *IS*!
1547+
// In production this refers to an *extern static* which *is* unsafe to reference.
1548+
// In tests this refers to a local static because we don't have Firefox's codebase
1549+
// providing the symbol!
15451550
unsafe { self.ptr.as_ptr() as *const Header == &EMPTY_HEADER }
15461551
}
15471552

0 commit comments

Comments
 (0)