diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2025-03-20 20:06:11 -0400 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-04-18 21:53:00 +0900 |
| commit | e5647d8bd983d1859a2dbc0455e805608979e174 (patch) | |
| tree | b3010f961a77e6a929749af1d3da750f01262292 | |
| parent | 6421e8996209c61f7ddefdd173df451adfc1d775 (diff) | |
Assert that ids are initialized
I've been bit by this a couple times.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
| -rw-r--r-- | zjit/src/cruby.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/zjit/src/cruby.rs b/zjit/src/cruby.rs index c30129eda9..601a28002b 100644 --- a/zjit/src/cruby.rs +++ b/zjit/src/cruby.rs @@ -1175,8 +1175,10 @@ pub(crate) mod ids { /// Get an CRuby `ID` to an interned string, e.g. a particular method name. macro_rules! ID { - ($id_name:ident) => { - $crate::cruby::ids::$id_name.load(std::sync::atomic::Ordering::Relaxed) - } + ($id_name:ident) => {{ + let id = $crate::cruby::ids::$id_name.load(std::sync::atomic::Ordering::Relaxed); + debug_assert_ne!(0, id, "ids module should be initialized"); + id + }} } pub(crate) use ID; |
