From d8293cd8bc88eef54f95e2ad11441d2b8f4b6061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kangwook=20Lee=20=28=EC=9D=B4=EA=B0=95=EC=9A=B1=29?= Date: Mon, 26 Jun 2023 06:41:48 +0900 Subject: [PATCH] fix(ops): quoting serde_v8::Value (#19593) The following code: ```rust use deno_core::op; #[op] fn ops_serde_v8(value: serde_v8::Value) { // } fn main() { // } ``` ...with the following `Cargo.toml`: ```toml [package] name = "playground" version = "0.1.0" edition = "2021" [dependencies] deno_core = "0.191.0" serde_v8 = "0.102.0" ``` ...will not compile with the error: ``` error[E0433]: failed to resolve: use of undeclared crate or module `v8` --> src/main.rs:3:1 | 3 | #[op] | ^^^^^ use of undeclared crate or module `v8` | = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info) ``` This PR is fixing the above issue by properly quoting `deno_core::v8::Value` instead of `v8::Value`. --- ops/optimizer.rs | 2 +- ops/optimizer_tests/serde_v8_value.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ops/optimizer.rs b/ops/optimizer.rs index 09d3d5be67..d8c3b99e28 100644 --- a/ops/optimizer.rs +++ b/ops/optimizer.rs @@ -145,7 +145,7 @@ impl Transform { match &self.kind { // serde_v8::Value TransformKind::V8Value => { - *ty = parse_quote! { #core::v8::Local }; + *ty = parse_quote! { #core::v8::Local<#core::v8::Value> }; q!(Vars { var: &ident }, { let var = serde_v8::Value { v8_value: var }; diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out index 1a3d1ed31c..034caec508 100644 --- a/ops/optimizer_tests/serde_v8_value.out +++ b/ops/optimizer_tests/serde_v8_value.out @@ -88,7 +88,7 @@ impl op_is_proxy { #[allow(clippy::too_many_arguments)] fn op_is_proxy_fast_fn<'scope>( _: deno_core::v8::Local, - value: deno_core::v8::Local, + value: deno_core::v8::Local, ) -> bool { use deno_core::v8; use deno_core::_ops;