summaryrefslogtreecommitdiff
path: root/ext/ffi
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi')
-rw-r--r--ext/ffi/call.rs6
-rw-r--r--ext/ffi/lib.rs25
2 files changed, 6 insertions, 25 deletions
diff --git a/ext/ffi/call.rs b/ext/ffi/call.rs
index ad12d0985..ea7875108 100644
--- a/ext/ffi/call.rs
+++ b/ext/ffi/call.rs
@@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use crate::callback::PtrSymbol;
-use crate::check_unstable2;
+use crate::check_unstable;
use crate::dlfcn::DynamicLibraryResource;
use crate::ir::*;
use crate::symbol::NativeType;
@@ -285,7 +285,7 @@ pub fn op_ffi_call_ptr_nonblocking<FP>(
where
FP: FfiPermissions + 'static,
{
- check_unstable2(&state, "Deno.UnsafeFnPointer#call");
+ check_unstable(&state.borrow(), "Deno.UnsafeFnPointer#call");
{
let mut state = state.borrow_mut();
let permissions = state.borrow_mut::<FP>();
@@ -381,7 +381,7 @@ pub fn op_ffi_call_ptr<FP>(
where
FP: FfiPermissions + 'static,
{
- check_unstable2(&state, "Deno.UnsafeFnPointer#call");
+ check_unstable(&state.borrow(), "Deno.UnsafeFnPointer#call");
{
let mut state = state.borrow_mut();
let permissions = state.borrow_mut::<FP>();
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs
index b5a2a3bd5..1ca921119 100644
--- a/ext/ffi/lib.rs
+++ b/ext/ffi/lib.rs
@@ -45,22 +45,10 @@ const _: () = {
pub(crate) const MAX_SAFE_INTEGER: isize = 9007199254740991;
pub(crate) const MIN_SAFE_INTEGER: isize = -9007199254740991;
-pub struct Unstable(pub bool);
-
fn check_unstable(state: &OpState, api_name: &str) {
- let unstable = state.borrow::<Unstable>();
-
- if !unstable.0 {
- eprintln!(
- "Unstable API '{api_name}'. The --unstable flag must be provided."
- );
- std::process::exit(70);
- }
-}
-
-pub fn check_unstable2(state: &Rc<RefCell<OpState>>, api_name: &str) {
- let state = state.borrow();
- check_unstable(&state, api_name)
+ state
+ .feature_checker
+ .check_legacy_unstable_or_exit(api_name);
}
pub trait FfiPermissions {
@@ -108,13 +96,6 @@ deno_core::extension!(deno_ffi,
op_ffi_unsafe_callback_ref,
],
esm = [ "00_ffi.js" ],
- options = {
- unstable: bool,
- },
- state = |state, options| {
- // Stolen from deno_webgpu, is there a better option?
- state.put(Unstable(options.unstable));
- },
event_loop_middleware = event_loop_middleware,
);