summaryrefslogtreecommitdiff
path: root/ext/ffi/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-10-04 21:42:17 +0200
committerGitHub <noreply@github.com>2023-10-04 21:42:17 +0200
commita5568066b3d979111134029f9e4f0c1b462b948e (patch)
tree14c4233cc01d55eda7f608b5194f6b088264b52e /ext/ffi/lib.rs
parent9a46a824bd897e240af8a14f9d950ab6d95f42a5 (diff)
refactor: use deno_core::FeatureChecker for unstable checks (#20765)
Diffstat (limited to 'ext/ffi/lib.rs')
-rw-r--r--ext/ffi/lib.rs25
1 files changed, 3 insertions, 22 deletions
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,
);