aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/geckolib/string_cache/lib.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/ports/geckolib/string_cache/lib.rs b/ports/geckolib/string_cache/lib.rs
index 1301fe091c5..fa59045a419 100644
--- a/ports/geckolib/string_cache/lib.rs
+++ b/ports/geckolib/string_cache/lib.rs
@@ -171,9 +171,18 @@ impl Atom {
mem::forget(atom);
}
+ /// Creates an atom from an static atom pointer without checking in release
+ /// builds.
+ ///
+ /// Right now it's only used by the atom macro, and ideally it should keep
+ /// that way, now we have sugar for is_static, creating atoms using
+ /// Atom::from should involve almost no overhead.
#[inline]
unsafe fn from_static(ptr: *mut nsIAtom) -> Self {
- Atom(ptr as *mut WeakAtom)
+ let atom = Atom(ptr as *mut WeakAtom);
+ debug_assert!(atom.is_static(),
+ "Called from_static for a non-static atom!");
+ atom
}
}