diff options
Diffstat (limited to 'ops/tests')
-rw-r--r-- | ops/tests/compile_fail/mem_slices.rs | 24 | ||||
-rw-r--r-- | ops/tests/compile_fail/mem_slices.stderr | 15 |
2 files changed, 39 insertions, 0 deletions
diff --git a/ops/tests/compile_fail/mem_slices.rs b/ops/tests/compile_fail/mem_slices.rs new file mode 100644 index 000000000..da74ac577 --- /dev/null +++ b/ops/tests/compile_fail/mem_slices.rs @@ -0,0 +1,24 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +use deno_ops::op; + +#[op] +fn sync_test(slice: &mut [u32]) { + // +} + +#[op] +async fn async_test(slice: &[u8]) { + // Memory slices are not allowed in async ops. +} + +#[op] +fn async_test2(slice: &mut [u8]) -> impl Future<Output = ()> { + // Memory slices are not allowed in async ops, even when not implemented as an + // async function. + async {} +} + +fn main() { + // pass +} diff --git a/ops/tests/compile_fail/mem_slices.stderr b/ops/tests/compile_fail/mem_slices.stderr new file mode 100644 index 000000000..c45acfcf9 --- /dev/null +++ b/ops/tests/compile_fail/mem_slices.stderr @@ -0,0 +1,15 @@ +error: custom attribute panicked + --> tests/compile_fail/mem_slices.rs:10:1 + | +10 | #[op] + | ^^^^^ + | + = help: message: Memory slices are not allowed in async ops + +error: custom attribute panicked + --> tests/compile_fail/mem_slices.rs:15:1 + | +15 | #[op] + | ^^^^^ + | + = help: message: Memory slices are not allowed in async ops |