mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
stylo: Add debug docs assertion in Atom::from_static()
This commit is contained in:
parent
2b3c684b37
commit
09cc240d4c
1 changed files with 10 additions and 1 deletions
|
@ -171,9 +171,18 @@ impl Atom {
|
||||||
mem::forget(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]
|
#[inline]
|
||||||
unsafe fn from_static(ptr: *mut nsIAtom) -> Self {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue