aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-08-15 23:02:24 -0700
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-08-15 23:02:24 -0700
commit09cc240d4cd3cb2af1d049c15c4e41186fc7dfc6 (patch)
tree0356746432438fdfa999df7370f4a52b73a569c4
parent2b3c684b373221626bab78f8119416513425294d (diff)
downloadservo-09cc240d4cd3cb2af1d049c15c4e41186fc7dfc6.tar.gz
servo-09cc240d4cd3cb2af1d049c15c4e41186fc7dfc6.zip
stylo: Add debug docs assertion in Atom::from_static()
-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
}
}