fix(napi): cargo doc build

- Close https://github.com/napi-rs/napi-rs/issues/1800
This commit is contained in:
LongYinan 2023-11-20 16:22:21 +08:00 committed by GitHub
parent 751312cec9
commit 7dced934a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ use std::sync::{
Arc, Arc,
}; };
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
use crate::bindgen_prelude::{CUSTOM_GC_TSFN, CUSTOM_GC_TSFN_DESTROYED, THREADS_CAN_ACCESS_ENV}; use crate::bindgen_prelude::{CUSTOM_GC_TSFN, CUSTOM_GC_TSFN_DESTROYED, THREADS_CAN_ACCESS_ENV};
pub use crate::js_values::TypedArrayType; pub use crate::js_values::TypedArrayType;
use crate::{check_status, sys, Error, Result, Status}; use crate::{check_status, sys, Error, Result, Status};
@ -80,7 +80,7 @@ macro_rules! impl_typed_array {
if ref_.is_null() { if ref_.is_null() {
return; return;
} }
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
{ {
if CUSTOM_GC_TSFN_DESTROYED.load(Ordering::SeqCst) { if CUSTOM_GC_TSFN_DESTROYED.load(Ordering::SeqCst) {
return; return;

View file

@ -9,7 +9,7 @@ use std::sync::Arc;
#[cfg(all(debug_assertions, not(windows)))] #[cfg(all(debug_assertions, not(windows)))]
use std::sync::Mutex; use std::sync::Mutex;
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
use crate::bindgen_prelude::{CUSTOM_GC_TSFN, CUSTOM_GC_TSFN_DESTROYED, THREADS_CAN_ACCESS_ENV}; use crate::bindgen_prelude::{CUSTOM_GC_TSFN, CUSTOM_GC_TSFN_DESTROYED, THREADS_CAN_ACCESS_ENV};
use crate::{bindgen_prelude::*, check_status, sys, Result, ValueType}; use crate::{bindgen_prelude::*, check_status, sys, Result, ValueType};
@ -37,7 +37,7 @@ impl Drop for Buffer {
if ref_.is_null() { if ref_.is_null() {
return; return;
} }
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
{ {
if CUSTOM_GC_TSFN_DESTROYED.load(std::sync::atomic::Ordering::SeqCst) { if CUSTOM_GC_TSFN_DESTROYED.load(std::sync::atomic::Ordering::SeqCst) {
return; return;

View file

@ -74,12 +74,12 @@ static IS_FIRST_MODULE: AtomicBool = AtomicBool::new(true);
static FIRST_MODULE_REGISTERED: AtomicBool = AtomicBool::new(false); static FIRST_MODULE_REGISTERED: AtomicBool = AtomicBool::new(false);
static REGISTERED_CLASSES: Lazy<RegisteredClassesMap> = Lazy::new(Default::default); static REGISTERED_CLASSES: Lazy<RegisteredClassesMap> = Lazy::new(Default::default);
static FN_REGISTER_MAP: Lazy<FnRegisterMap> = Lazy::new(Default::default); static FN_REGISTER_MAP: Lazy<FnRegisterMap> = Lazy::new(Default::default);
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
pub(crate) static CUSTOM_GC_TSFN: AtomicPtr<sys::napi_threadsafe_function__> = pub(crate) static CUSTOM_GC_TSFN: AtomicPtr<sys::napi_threadsafe_function__> =
AtomicPtr::new(ptr::null_mut()); AtomicPtr::new(ptr::null_mut());
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
pub(crate) static CUSTOM_GC_TSFN_DESTROYED: AtomicBool = AtomicBool::new(false); pub(crate) static CUSTOM_GC_TSFN_DESTROYED: AtomicBool = AtomicBool::new(false);
#[cfg(all(feature = "napi4", not(target_os = "wasi")))] #[cfg(all(feature = "napi4", not(feature = "noop"), not(target_os = "wasi")))]
// Store thread id of the thread that created the CustomGC ThreadsafeFunction. // Store thread id of the thread that created the CustomGC ThreadsafeFunction.
pub(crate) static THREADS_CAN_ACCESS_ENV: once_cell::sync::Lazy< pub(crate) static THREADS_CAN_ACCESS_ENV: once_cell::sync::Lazy<
PersistedPerInstanceHashMap<ThreadId, bool>, PersistedPerInstanceHashMap<ThreadId, bool>,