@@ -17,7 +17,7 @@ pub use sys::out;
17
17
18
18
#[ cfg( feature = "trace" ) ]
19
19
pub use crate :: meta:: trace;
20
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
20
+ #[ cfg( debug_assertions) ]
21
21
use std:: cell:: RefCell ;
22
22
23
23
use crate :: global:: godot_error;
@@ -321,12 +321,12 @@ pub(crate) fn has_error_print_level(level: u8) -> bool {
321
321
/// Internal type used to store context information for debug purposes. Debug context is stored on the thread-local
322
322
/// ERROR_CONTEXT_STACK, which can later be used to retrieve the current context in the event of a panic. This value
323
323
/// probably shouldn't be used directly; use ['get_gdext_panic_context()'](get_gdext_panic_context) instead.
324
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
324
+ #[ cfg( debug_assertions) ]
325
325
struct ScopedFunctionStack {
326
326
functions : Vec < * const dyn Fn ( ) -> String > ,
327
327
}
328
328
329
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
329
+ #[ cfg( debug_assertions) ]
330
330
impl ScopedFunctionStack {
331
331
/// # Safety
332
332
/// Function must be removed (using [`pop_function()`](Self::pop_function)) before lifetime is invalidated.
@@ -351,7 +351,7 @@ impl ScopedFunctionStack {
351
351
}
352
352
}
353
353
354
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
354
+ #[ cfg( debug_assertions) ]
355
355
thread_local ! {
356
356
static ERROR_CONTEXT_STACK : RefCell <ScopedFunctionStack > = const {
357
357
RefCell :: new( ScopedFunctionStack { functions: Vec :: new( ) } )
@@ -360,10 +360,10 @@ thread_local! {
360
360
361
361
// Value may return `None`, even from panic hook, if called from a non-Godot thread.
362
362
pub fn get_gdext_panic_context ( ) -> Option < String > {
363
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
363
+ #[ cfg( debug_assertions) ]
364
364
return ERROR_CONTEXT_STACK . with ( |cell| cell. borrow ( ) . get_last ( ) ) ;
365
365
366
- #[ cfg( not( all ( debug_assertions, not ( wasm_nothreads ) ) ) ) ]
366
+ #[ cfg( not( debug_assertions) ) ]
367
367
None
368
368
}
369
369
@@ -378,10 +378,10 @@ where
378
378
E : Fn ( ) -> String ,
379
379
F : FnOnce ( ) -> R + std:: panic:: UnwindSafe ,
380
380
{
381
- #[ cfg( not( all ( debug_assertions, not ( wasm_nothreads ) ) ) ) ]
382
- let _ = error_context; // Unused in Release or `wasm_nothreads` builds .
381
+ #[ cfg( not( debug_assertions) ) ]
382
+ let _ = error_context; // Unused in Release.
383
383
384
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
384
+ #[ cfg( debug_assertions) ]
385
385
ERROR_CONTEXT_STACK . with ( |cell| unsafe {
386
386
// SAFETY: &error_context is valid for lifetime of function, and is removed from LAST_ERROR_CONTEXT before end of function.
387
387
cell. borrow_mut ( ) . push_function ( & error_context)
@@ -390,7 +390,7 @@ where
390
390
let result =
391
391
std:: panic:: catch_unwind ( code) . map_err ( |payload| extract_panic_message ( payload. as_ref ( ) ) ) ;
392
392
393
- #[ cfg( all ( debug_assertions, not ( wasm_nothreads ) ) ) ]
393
+ #[ cfg( debug_assertions) ]
394
394
ERROR_CONTEXT_STACK . with ( |cell| cell. borrow_mut ( ) . pop_function ( ) ) ;
395
395
result
396
396
}
0 commit comments