From 5f09b5d9d9a28a9eb367ece4fef77fef51cc6664 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 25 Feb 2023 20:58:40 +0800 Subject: [PATCH] Fix builds. --- CHANGELOG.md | 1 + src/engine.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6be94fc5..07b73d9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Potentially breaking changes Enhancements ------------ +* `Engine::new_raw` is now `const` and runs very fast, delaying all other initialization until first use. * The functions `min` and `max` are added for numbers. * Range cases in `switch` statements now also match floating-point and decimal values. In order to support this, however, small numeric ranges cases are no longer unrolled. * Loading a module via `import` now gives the module access to the current scope, including variables and constants defined inside. diff --git a/src/engine.rs b/src/engine.rs index 3175c611..fd4e31ef 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -326,7 +326,11 @@ impl Engine { &self, string: impl AsRef + Into, ) -> ImmutableString { - locked_write(&self.interned_strings).get(string) + if let Some(ref interner) = self.interned_strings { + locked_write(interner).get(string) + } else { + string.into() + } } /// _(internals)_ Get an interned [string][ImmutableString].