55 * file, You can obtain one at https://mozilla.org/MPL/2.0/. 
66 */ 
77
8- #[ cfg( debug_assertions ) ]  
8+ #[ cfg( checks_at_least =  "paranoid" ) ]  
99use  std:: cell:: Cell ; 
1010use  std:: cell:: RefCell ; 
1111use  std:: collections:: hash_map:: Entry ; 
@@ -27,7 +27,7 @@ thread_local! {
2727} 
2828
2929/// Represents the initialization state of a `Base<T>` object. 
30- #[ cfg( debug_assertions ) ]  
30+ #[ cfg( checks_at_least =  "paranoid" ) ]  
3131#[ derive( Debug ,  Copy ,  Clone ,  PartialEq ,  Eq ) ]  
3232enum  InitState  { 
3333    /// Object is being constructed (inside `I*::init()` or `Gd::from_init_fn()`). 
@@ -38,14 +38,14 @@ enum InitState {
3838     Script , 
3939} 
4040
41- #[ cfg( debug_assertions ) ]  
41+ #[ cfg( checks_at_least =  "paranoid" ) ]  
4242macro_rules!  base_from_obj { 
4343    ( $obj: expr,  $state: expr)  => { 
4444        Base :: from_obj( $obj,  $state) 
4545    } ; 
4646} 
4747
48- #[ cfg( not( debug_assertions ) ) ]  
48+ #[ cfg( not( checks_at_least =  "paranoid" ) ) ]  
4949macro_rules!  base_from_obj { 
5050    ( $obj: expr,  $state: expr)  => { 
5151        Base :: from_obj( $obj) 
@@ -82,7 +82,7 @@ pub struct Base<T: GodotClass> {
8282    /// Tracks the initialization state of this `Base<T>` in Debug mode. 
8383     /// 
8484     /// Rc allows to "copy-construct" the base from an existing one, while still affecting the user-instance through the original `Base<T>`. 
85-      #[ cfg( debug_assertions ) ]  
85+      #[ cfg( checks_at_least =  "paranoid" ) ]  
8686    init_state :  Rc < Cell < InitState > > , 
8787} 
8888
@@ -101,7 +101,7 @@ impl<T: GodotClass> Base<T> {
101101
102102        Self  { 
103103            obj :  ManuallyDrop :: new ( obj) , 
104-             #[ cfg( debug_assertions ) ]  
104+             #[ cfg( checks_at_least =  "paranoid" ) ]  
105105            init_state :  Rc :: clone ( & base. init_state ) , 
106106        } 
107107    } 
@@ -141,15 +141,15 @@ impl<T: GodotClass> Base<T> {
141141        base_from_obj ! ( obj,  InitState :: ObjectConstructing ) 
142142    } 
143143
144-     #[ cfg( debug_assertions ) ]  
144+     #[ cfg( checks_at_least =  "paranoid" ) ]  
145145    fn  from_obj ( obj :  Gd < T > ,  init_state :  InitState )  -> Self  { 
146146        Self  { 
147147            obj :  ManuallyDrop :: new ( obj) , 
148148            init_state :  Rc :: new ( Cell :: new ( init_state) ) , 
149149        } 
150150    } 
151151
152-     #[ cfg( not( debug_assertions ) ) ]  
152+     #[ cfg( not( checks_at_least =  "paranoid" ) ) ]  
153153    fn  from_obj ( obj :  Gd < T > )  -> Self  { 
154154        Self  { 
155155            obj :  ManuallyDrop :: new ( obj) , 
@@ -187,7 +187,7 @@ impl<T: GodotClass> Base<T> {
187187     /// If called outside an initialization function, or for ref-counted objects on a non-main thread. 
188188     #[ cfg( since_api = "4.2" ) ]  
189189    pub  fn  to_init_gd ( & self )  -> Gd < T >  { 
190-         #[ cfg( debug_assertions ) ]   // debug_assert! still checks existence of symbols. 
190+         #[ cfg( checks_at_least =  "paranoid" ) ]   // debug_assert! still checks existence of symbols. 
191191        assert ! ( 
192192            self . is_initializing( ) , 
193193            "Base::to_init_gd() can only be called during object initialization, inside I*::init() or Gd::from_init_fn()" 
@@ -253,7 +253,7 @@ impl<T: GodotClass> Base<T> {
253253
254254    /// Finalizes the initialization of this `Base<T>` and returns whether 
255255     pub ( crate )  fn  mark_initialized ( & mut  self )  { 
256-         #[ cfg( debug_assertions ) ]  
256+         #[ cfg( checks_at_least =  "paranoid" ) ]  
257257        { 
258258            assert_eq ! ( 
259259                self . init_state. get( ) , 
@@ -270,7 +270,7 @@ impl<T: GodotClass> Base<T> {
270270    /// Returns a [`Gd`] referencing the base object, assuming the derived object is fully constructed. 
271271     #[ doc( hidden) ]  
272272    pub  fn  __fully_constructed_gd ( & self )  -> Gd < T >  { 
273-         #[ cfg( debug_assertions ) ]   // debug_assert! still checks existence of symbols. 
273+         #[ cfg( checks_at_least =  "paranoid" ) ]   // debug_assert! still checks existence of symbols. 
274274        assert ! ( 
275275            !self . is_initializing( ) , 
276276            "WithBaseField::to_gd(), base(), base_mut() can only be called on fully-constructed objects, after I*::init() or Gd::from_init_fn()" 
@@ -301,7 +301,7 @@ impl<T: GodotClass> Base<T> {
301301
302302    /// Returns a [`Gd`] referencing the base object, for use in script contexts only. 
303303     pub ( crate )  fn  to_script_gd ( & self )  -> Gd < T >  { 
304-         #[ cfg( debug_assertions ) ]  
304+         #[ cfg( checks_at_least =  "paranoid" ) ]  
305305        assert_eq ! ( 
306306            self . init_state. get( ) , 
307307            InitState :: Script , 
@@ -312,15 +312,15 @@ impl<T: GodotClass> Base<T> {
312312    } 
313313
314314    /// Returns `true` if this `Base<T>` is currently in the initializing state. 
315-      #[ cfg( debug_assertions ) ]  
315+      #[ cfg( checks_at_least =  "paranoid" ) ]  
316316    fn  is_initializing ( & self )  -> bool  { 
317317        self . init_state . get ( )  == InitState :: ObjectConstructing 
318318    } 
319319
320320    /// Returns a [`Gd`] referencing the base object, assuming the derived object is fully constructed. 
321321     #[ doc( hidden) ]  
322322    pub  fn  __constructed_gd ( & self )  -> Gd < T >  { 
323-         #[ cfg( debug_assertions ) ]   // debug_assert! still checks existence of symbols. 
323+         #[ cfg( checks_at_least =  "paranoid" ) ]   // debug_assert! still checks existence of symbols. 
324324        assert ! ( 
325325            !self . is_initializing( ) , 
326326            "WithBaseField::to_gd(), base(), base_mut() can only be called on fully-constructed objects, after I*::init() or Gd::from_init_fn()" 
0 commit comments