@@ -318,7 +318,10 @@ impl<BorrowType: marker::BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type>
318318pub  fn  ascend ( 
319319        self , 
320320    )  -> Result < Handle < NodeRef < BorrowType ,  K ,  V ,  marker:: Internal > ,  marker:: Edge > ,  Self >  { 
321-         let  _ = BorrowType :: TRAVERSAL_PERMIT ; 
321+         const  { 
322+             assert ! ( BorrowType :: TRAVERSAL_PERMIT ) ; 
323+         } 
324+ 
322325        // We need to use raw pointers to nodes because, if BorrowType is marker::ValMut, 
323326        // there might be outstanding mutable references to values that we must not invalidate. 
324327        let  leaf_ptr:  * const  _  = Self :: as_leaf_ptr ( & self ) ; 
@@ -1003,7 +1006,10 @@ impl<BorrowType: marker::BorrowType, K, V>
10031006/// `edge.descend().ascend().unwrap()` and `node.ascend().unwrap().descend()` should 
10041007/// both, upon success, do nothing. 
10051008pub  fn  descend ( self )  -> NodeRef < BorrowType ,  K ,  V ,  marker:: LeafOrInternal >  { 
1006-         let  _ = BorrowType :: TRAVERSAL_PERMIT ; 
1009+         const  { 
1010+             assert ! ( BorrowType :: TRAVERSAL_PERMIT ) ; 
1011+         } 
1012+ 
10071013        // We need to use raw pointers to nodes because, if BorrowType is 
10081014        // marker::ValMut, there might be outstanding mutable references to 
10091015        // values that we must not invalidate. There's no worry accessing the 
@@ -1666,17 +1672,17 @@ pub mod marker {
16661672    pub  struct  ValMut < ' a > ( PhantomData < & ' a  mut  ( ) > ) ; 
16671673
16681674    pub  trait  BorrowType  { 
1669-         // If node references of this borrow type allow traversing to other 
1670-         // nodes in the tree, this constant can be evaluated. Thus reading it  
1671-         // serves as  a compile-time assertion. 
1672-         const  TRAVERSAL_PERMIT :  ( )  = ( ) ; 
1675+         ///  If node references of this borrow type allow traversing to other 
1676+ ///  nodes in the tree, this constant is set to `true`. It can be used  
1677+ /// for  a compile-time assertion. 
1678+ const  TRAVERSAL_PERMIT :  bool  = true ; 
16731679    } 
16741680    impl  BorrowType  for  Owned  { 
1675-         // Reject evaluation , because traversal  isn't needed. Instead traversal 
1676-         // happens using the result of `borrow_mut`. 
1677-         // By disabling traversal, and only creating new references to roots, 
1678-         // we know that every reference of the `Owned` type is to a root node. 
1679-         const  TRAVERSAL_PERMIT :  ( )  = panic ! ( ) ; 
1681+         ///  Reject traversal , because it  isn't needed. Instead traversal 
1682+ ///  happens using the result of `borrow_mut`. 
1683+ ///  By disabling traversal, and only creating new references to roots, 
1684+ ///  we know that every reference of the `Owned` type is to a root node. 
1685+ const  TRAVERSAL_PERMIT :  bool  = false ; 
16801686    } 
16811687    impl  BorrowType  for  Dying  { } 
16821688    impl < ' a >  BorrowType  for  Immut < ' a >  { } 
0 commit comments