mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
fix(ops): circular dependency in deno_ops test (#16809)
This commit is contained in:
parent
d80af8324d
commit
8fc62f93bf
9 changed files with 6 additions and 74 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1160,7 +1160,6 @@ dependencies = [
|
||||||
name = "deno_ops"
|
name = "deno_ops"
|
||||||
version = "0.39.0"
|
version = "0.39.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deno_core",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pmutil",
|
"pmutil",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
|
|
|
@ -24,7 +24,6 @@ regex.workspace = true
|
||||||
syn.workspace = true
|
syn.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
deno_core.workspace = true
|
|
||||||
prettyplease = "0.1.21"
|
prettyplease = "0.1.21"
|
||||||
testing_macros = "0.2.7"
|
testing_macros = "0.2.7"
|
||||||
trybuild = "1.0.71"
|
trybuild = "1.0.71"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||||
|
#![cfg(not(test))]
|
||||||
|
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use proc_macro_crate::{crate_name, FoundCrate};
|
use proc_macro_crate::{crate_name, FoundCrate};
|
||||||
|
|
|
@ -432,7 +432,7 @@ mod tests {
|
||||||
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
|
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
|
||||||
fn test_fast_call_codegen(input: PathBuf) {
|
fn test_fast_call_codegen(input: PathBuf) {
|
||||||
let update_expected = std::env::var("UPDATE_EXPECTED").is_ok();
|
let update_expected = std::env::var("UPDATE_EXPECTED").is_ok();
|
||||||
let core = crate::deno::import();
|
let core = quote!(deno_core);
|
||||||
|
|
||||||
let source =
|
let source =
|
||||||
std::fs::read_to_string(&input).expect("Failed to read test file");
|
std::fs::read_to_string(&input).expect("Failed to read test file");
|
||||||
|
|
|
@ -17,9 +17,6 @@ mod deno;
|
||||||
mod fast_call;
|
mod fast_call;
|
||||||
mod optimizer;
|
mod optimizer;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests;
|
|
||||||
|
|
||||||
const SCOPE_LIFETIME: &str = "'scope";
|
const SCOPE_LIFETIME: &str = "'scope";
|
||||||
|
|
||||||
/// Add the 'scope lifetime to the function signature.
|
/// Add the 'scope lifetime to the function signature.
|
||||||
|
@ -60,6 +57,10 @@ impl Op {
|
||||||
|
|
||||||
let is_async = item.sig.asyncness.is_some() || is_future(&item.sig.output);
|
let is_async = item.sig.asyncness.is_some() || is_future(&item.sig.output);
|
||||||
let type_params = exclude_lifetime_params(&item.sig.generics.params);
|
let type_params = exclude_lifetime_params(&item.sig.generics.params);
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
let core = quote!(deno_core);
|
||||||
|
#[cfg(not(test))]
|
||||||
let core = deno::import();
|
let core = deno::import();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
use deno_core::v8::fast_api::FastApiCallbackOptions;
|
|
||||||
use deno_ops::op;
|
|
||||||
|
|
||||||
#[op(fast)]
|
|
||||||
fn op_fallback(options: Option<&mut FastApiCallbackOptions>) {
|
|
||||||
if let Some(options) = options {
|
|
||||||
options.fallback = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
use deno_ops::op;
|
|
||||||
|
|
||||||
#[op(fast)]
|
|
||||||
fn op_u8_arg(a: u8, b: u8) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
#[op(fast)]
|
|
||||||
fn op_u16_arg(a: u16, b: u16) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
use deno_core::v8::fast_api::FastApiCallbackOptions;
|
|
||||||
|
|
||||||
#[op(fast)]
|
|
||||||
fn op_callback_options(options: &mut FastApiCallbackOptions) {
|
|
||||||
// fast callback options must be an Option.
|
|
||||||
}
|
|
||||||
|
|
||||||
#[op(fast)]
|
|
||||||
async fn op_async_fn(a: i32, b: i32) -> i32 {
|
|
||||||
a + b
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
// pass
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
error[E0277]: the trait bound `&mut FastApiCallbackOptions<'_>: Deserialize<'_>` is not satisfied
|
|
||||||
--> tests/compile_fail/unsupported.rs:17:1
|
|
||||||
|
|
|
||||||
17 | #[op(fast)]
|
|
||||||
| ^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `&mut FastApiCallbackOptions<'_>`
|
|
||||||
|
|
|
||||||
= help: the following other types implement trait `Deserialize<'de>`:
|
|
||||||
&'a Path
|
|
||||||
&'a [u8]
|
|
||||||
&'a str
|
|
||||||
()
|
|
||||||
(T0, T1)
|
|
||||||
(T0, T1, T2)
|
|
||||||
(T0, T1, T2, T3)
|
|
||||||
(T0, T1, T2, T3, T4)
|
|
||||||
and 143 others
|
|
||||||
note: required by a bound in `from_v8`
|
|
||||||
--> $WORKSPACE/serde_v8/de.rs
|
|
||||||
|
|
|
||||||
| T: Deserialize<'de>,
|
|
||||||
| ^^^^^^^^^^^^^^^^ required by this bound in `from_v8`
|
|
||||||
= note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
@ -1,6 +0,0 @@
|
||||||
#[test]
|
|
||||||
fn op_macro() {
|
|
||||||
let t = trybuild::TestCases::new();
|
|
||||||
t.compile_fail("tests/compile_fail/*.rs");
|
|
||||||
t.pass("tests/01_fast_callback_options.rs");
|
|
||||||
}
|
|
Loading…
Reference in a new issue