diff options
| author | 2022-07-13 03:14:50 -0400 | |
|---|---|---|
| committer | 2022-07-13 03:14:50 -0400 | |
| commit | 71930db9b0acd09539957e4278c448711e237a4d (patch) | |
| tree | 4fb7ad7b0d824b81285cccd8a18ceb46acd8881a | |
| parent | e4016c1a77290d8f61a4bdf174e336b0ad432a90 (diff) | |
| download | bun-71930db9b0acd09539957e4278c448711e237a4d.tar.gz bun-71930db9b0acd09539957e4278c448711e237a4d.tar.zst bun-71930db9b0acd09539957e4278c448711e237a4d.zip | |
fix benchmark not building with old rust version
| -rw-r--r-- | bench/ffi/bun.js | 2 | ||||
| -rw-r--r-- | bench/ffi/deno.js | 2 | ||||
| -rw-r--r-- | bench/ffi/src/Cargo.toml | 2 | ||||
| -rw-r--r-- | bench/ffi/src/build.rs | 4 | ||||
| -rw-r--r-- | bench/ffi/src/package.json | 2 | ||||
| -rw-r--r-- | bench/ffi/src/src/lib.rs | 10 |
6 files changed, 11 insertions, 11 deletions
diff --git a/bench/ffi/bun.js b/bench/ffi/bun.js index ccf81f366..033af76f5 100644 --- a/bench/ffi/bun.js +++ b/bench/ffi/bun.js @@ -11,7 +11,7 @@ const { } = dlopen("./src/ffi_napi_bench.node", { ffi_noop: { args: [], returns: "void" }, ffi_string: { args: [], returns: "ptr" }, - ffi_hash: { args: ["ptr", "usize"], returns: "u32" }, + ffi_hash: { args: ["ptr", "u32"], returns: "u32" }, }); const bytes = new Uint8Array(64); diff --git a/bench/ffi/deno.js b/bench/ffi/deno.js index ee6206108..1882d7fd2 100644 --- a/bench/ffi/deno.js +++ b/bench/ffi/deno.js @@ -11,7 +11,7 @@ const { } = Deno.dlopen(path, { ffi_noop: { parameters: [], result: "void" }, ffi_string: { parameters: [], result: "pointer" }, - ffi_hash: { parameters: ["pointer", "usize"], result: "u32" }, + ffi_hash: { parameters: ["pointer", "u32"], result: "u32" }, }); const bytes = new Uint8Array(64); diff --git a/bench/ffi/src/Cargo.toml b/bench/ffi/src/Cargo.toml index 84a30eeab..ed1eb550f 100644 --- a/bench/ffi/src/Cargo.toml +++ b/bench/ffi/src/Cargo.toml @@ -7,8 +7,8 @@ name = "ffi_napi_bench" crate-type = ["cdylib"] [features] -napi = [] default = [] +enable-napi = [] [dependencies] napi = "2" diff --git a/bench/ffi/src/build.rs b/bench/ffi/src/build.rs index 4624d829b..c996ab1a7 100644 --- a/bench/ffi/src/build.rs +++ b/bench/ffi/src/build.rs @@ -1,5 +1,5 @@ -#[cfg(feature="napi")] extern crate napi_build; +#[cfg(feature="enable-napi")] extern crate napi_build; fn main() { - #[cfg(feature="napi")] napi_build::setup(); + #[cfg(feature="enable-napi")] napi_build::setup(); }
\ No newline at end of file diff --git a/bench/ffi/src/package.json b/bench/ffi/src/package.json index 4049f22c8..434977826 100644 --- a/bench/ffi/src/package.json +++ b/bench/ffi/src/package.json @@ -12,6 +12,6 @@ "build:ffi": "cargo build --release", "build": "bun run build:napi && bun run build:ffi", "cleanup": "rm -f index.js index.d.ts && mv napi.*.node ffi_napi_bench.node", - "build:napi": "napi build --release --platform --no-dts-header --features napi && bun run cleanup" + "build:napi": "napi build --release --platform --no-dts-header --features enable-napi && bun run cleanup" } } diff --git a/bench/ffi/src/src/lib.rs b/bench/ffi/src/src/lib.rs index dd0bd9a00..dd0f80fcf 100644 --- a/bench/ffi/src/src/lib.rs +++ b/bench/ffi/src/src/lib.rs @@ -1,7 +1,7 @@ // double src o.O -#[cfg(feature="napi")] use napi_derive::napi; -#[cfg(feature="napi")] use napi::bindgen_prelude::*; +#[cfg(feature="enable-napi")] use napi_derive::napi; +#[cfg(feature="enable-napi")] use napi::bindgen_prelude::*; static STRING: &'static str = "Hello, world!\0"; @@ -17,7 +17,7 @@ fn hash(buf: &[u8]) -> u32 { -#[cfg(feature="napi")] +#[cfg(feature="enable-napi")] #[napi] pub fn napi_noop() { // do nothing } @@ -28,7 +28,7 @@ fn hash(buf: &[u8]) -> u32 { -#[cfg(feature="napi")] +#[cfg(feature="enable-napi")] #[napi] pub fn napi_string() -> &'static str { return &STRING[0..(STRING.len() - 1)]; } @@ -39,7 +39,7 @@ fn hash(buf: &[u8]) -> u32 { -#[cfg(feature="napi")] +#[cfg(feature="enable-napi")] #[napi] pub fn napi_hash(buffer: Buffer) -> u32 { return hash(&buffer); } |
