Skip to content

Commit e5647d8

Browse files
XrXrk0kubun
authored andcommitted
Assert that ids are initialized
I've been bit by this a couple times.
1 parent 6421e89 commit e5647d8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

zjit/src/cruby.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,10 @@ pub(crate) mod ids {
11751175

11761176
/// Get an CRuby `ID` to an interned string, e.g. a particular method name.
11771177
macro_rules! ID {
1178-
($id_name:ident) => {
1179-
$crate::cruby::ids::$id_name.load(std::sync::atomic::Ordering::Relaxed)
1180-
}
1178+
($id_name:ident) => {{
1179+
let id = $crate::cruby::ids::$id_name.load(std::sync::atomic::Ordering::Relaxed);
1180+
debug_assert_ne!(0, id, "ids module should be initialized");
1181+
id
1182+
}}
11811183
}
11821184
pub(crate) use ID;

0 commit comments

Comments
 (0)