perf: 收紧字符串借用语义消除跨分配点 UB

This commit is contained in:
2026-08-13 16:24:00 +08:00
parent 352f3359cd
commit e62bc54f08
7 changed files with 30 additions and 12 deletions
@@ -22,7 +22,7 @@ fn run(module: &CompiledModule) -> JsValue {
fn eval_str(source: &str) -> String {
let v = eval(source);
if v.is_string() {
unsafe { oxide_runtime_api::string_data(v) }.to_string()
oxide_runtime_api::to_string(v)
} else {
format!("{v}")
}
+1 -1
View File
@@ -28,7 +28,7 @@ fn eval_int(source: &str) -> i32 {
fn eval_str(source: &str) -> String {
let v = eval(source);
if v.is_string() {
unsafe { oxide_runtime_api::string_data(v) }.to_string()
oxide_runtime_api::to_string(v)
} else {
format!("{v}")
}