1- use  core:: borrow:: Borrow ; 
2- use  core:: cmp:: Ordering ; 
1+ use  core:: cmp:: { Comparable ,  Ordering } ; 
32use  core:: error:: Error ; 
43use  core:: fmt:: { self ,  Debug } ; 
54use  core:: hash:: { Hash ,  Hasher } ; 
@@ -316,8 +315,7 @@ impl<K, A: Allocator + Clone> BTreeMap<K, SetValZST, A> {
316315
317316    pub ( super )  fn  get_or_insert_with < Q :  ?Sized ,  F > ( & mut  self ,  q :  & Q ,  f :  F )  -> & K 
318317    where 
319-         K :  Borrow < Q >  + Ord , 
320-         Q :  Ord , 
318+         K :  Comparable < Q >  + Ord , 
321319        F :  FnOnce ( & Q )  -> K , 
322320    { 
323321        let  ( map,  dormant_map)  = DormantMutRef :: new ( self ) ; 
@@ -327,7 +325,7 @@ impl<K, A: Allocator + Clone> BTreeMap<K, SetValZST, A> {
327325            Found ( handle)  => handle. into_kv_mut ( ) . 0 , 
328326            GoDown ( handle)  => { 
329327                let  key = f ( q) ; 
330-                 assert ! ( * key. borrow ( )  ==  * q ,  "new value is not equal" ) ; 
328+                 assert ! ( key. equivalent ( q ) ,  "new value is not equal" ) ; 
331329                VacantEntry  { 
332330                    key, 
333331                    handle :  Some ( handle) , 
@@ -694,8 +692,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
694692#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
695693    pub  fn  get < Q :  ?Sized > ( & self ,  key :  & Q )  -> Option < & V > 
696694    where 
697-         K :  Borrow < Q >  + Ord , 
698-         Q :  Ord , 
695+         K :  Comparable < Q >  + Ord , 
699696    { 
700697        let  root_node = self . root . as_ref ( ) ?. reborrow ( ) ; 
701698        match  root_node. search_tree ( key)  { 
@@ -760,8 +757,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
760757#[ stable( feature = "map_get_key_value" ,  since = "1.40.0" ) ]  
761758    pub  fn  get_key_value < Q :  ?Sized > ( & self ,  k :  & Q )  -> Option < ( & K ,  & V ) > 
762759    where 
763-         K :  Borrow < Q >  + Ord , 
764-         Q :  Ord , 
760+         K :  Comparable < Q >  + Ord , 
765761    { 
766762        let  root_node = self . root . as_ref ( ) ?. reborrow ( ) ; 
767763        match  root_node. search_tree ( k)  { 
@@ -956,8 +952,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
956952    #[ cfg_attr( not( test) ,  rustc_diagnostic_item = "btreemap_contains_key" ) ]  
957953    pub  fn  contains_key < Q :  ?Sized > ( & self ,  key :  & Q )  -> bool 
958954    where 
959-         K :  Borrow < Q >  + Ord , 
960-         Q :  Ord , 
955+         K :  Comparable < Q >  + Ord , 
961956    { 
962957        self . get ( key) . is_some ( ) 
963958    } 
@@ -983,8 +978,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
983978    #[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
984979    pub  fn  get_mut < Q :  ?Sized > ( & mut  self ,  key :  & Q )  -> Option < & mut  V > 
985980    where 
986-         K :  Borrow < Q >  + Ord , 
987-         Q :  Ord , 
981+         K :  Comparable < Q >  + Ord , 
988982    { 
989983        let  root_node = self . root . as_mut ( ) ?. borrow_mut ( ) ; 
990984        match  root_node. search_tree ( key)  { 
@@ -1085,8 +1079,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
10851079    #[ rustc_confusables( "delete" ,  "take" ) ]  
10861080    pub  fn  remove < Q :  ?Sized > ( & mut  self ,  key :  & Q )  -> Option < V > 
10871081    where 
1088-         K :  Borrow < Q >  + Ord , 
1089-         Q :  Ord , 
1082+         K :  Comparable < Q >  + Ord , 
10901083    { 
10911084        self . remove_entry ( key) . map ( |( _,  v) | v) 
10921085    } 
@@ -1110,8 +1103,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
11101103#[ stable( feature = "btreemap_remove_entry" ,  since = "1.45.0" ) ]  
11111104    pub  fn  remove_entry < Q :  ?Sized > ( & mut  self ,  key :  & Q )  -> Option < ( K ,  V ) > 
11121105    where 
1113-         K :  Borrow < Q >  + Ord , 
1114-         Q :  Ord , 
1106+         K :  Comparable < Q >  + Ord , 
11151107    { 
11161108        let  ( map,  dormant_map)  = DormantMutRef :: new ( self ) ; 
11171109        let  root_node = map. root . as_mut ( ) ?. borrow_mut ( ) ; 
@@ -1244,7 +1236,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
12441236    pub  fn  range < T :  ?Sized ,  R > ( & self ,  range :  R )  -> Range < ' _ ,  K ,  V > 
12451237    where 
12461238        T :  Ord , 
1247-         K :  Borrow < T >  +  Ord , 
1239+         K :  Comparable < T > , 
12481240        R :  RangeBounds < T > , 
12491241    { 
12501242        if  let  Some ( root)  = & self . root  { 
@@ -1284,7 +1276,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
12841276    pub  fn  range_mut < T :  ?Sized ,  R > ( & mut  self ,  range :  R )  -> RangeMut < ' _ ,  K ,  V > 
12851277    where 
12861278        T :  Ord , 
1287-         K :  Borrow < T >  +  Ord , 
1279+         K :  Comparable < T > , 
12881280        R :  RangeBounds < T > , 
12891281    { 
12901282        if  let  Some ( root)  = & mut  self . root  { 
@@ -1372,9 +1364,9 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
13721364/// assert_eq!(b[&41], "e"); 
13731365/// ``` 
13741366#[ stable( feature = "btree_split_off" ,  since = "1.11.0" ) ]  
1375-     pub  fn  split_off < Q :  ?Sized  +  Ord > ( & mut  self ,  key :  & Q )  -> Self 
1367+     pub  fn  split_off < Q :  ?Sized > ( & mut  self ,  key :  & Q )  -> Self 
13761368    where 
1377-         K :  Borrow < Q >  + Ord , 
1369+         K :  Comparable < Q >  + Ord , 
13781370        A :  Clone , 
13791371    { 
13801372        if  self . is_empty ( )  { 
@@ -2424,8 +2416,7 @@ impl<K: Debug, V: Debug, A: Allocator + Clone> Debug for BTreeMap<K, V, A> {
24242416#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
24252417impl < K ,  Q :  ?Sized ,  V ,  A :  Allocator  + Clone >  Index < & Q >  for  BTreeMap < K ,  V ,  A > 
24262418where 
2427-     K :  Borrow < Q >  + Ord , 
2428-     Q :  Ord , 
2419+     K :  Comparable < Q >  + Ord , 
24292420{ 
24302421    type  Output  = V ; 
24312422
@@ -2678,8 +2669,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
26782669#[ unstable( feature = "btree_cursors" ,  issue = "107540" ) ]  
26792670    pub  fn  lower_bound < Q :  ?Sized > ( & self ,  bound :  Bound < & Q > )  -> Cursor < ' _ ,  K ,  V > 
26802671    where 
2681-         K :  Borrow < Q >  + Ord , 
2682-         Q :  Ord , 
2672+         K :  Comparable < Q >  + Ord , 
26832673    { 
26842674        let  root_node = match  self . root . as_ref ( )  { 
26852675            None  => return  Cursor  {  current :  None ,  root :  None  } , 
@@ -2731,8 +2721,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
27312721#[ unstable( feature = "btree_cursors" ,  issue = "107540" ) ]  
27322722    pub  fn  lower_bound_mut < Q :  ?Sized > ( & mut  self ,  bound :  Bound < & Q > )  -> CursorMut < ' _ ,  K ,  V ,  A > 
27332723    where 
2734-         K :  Borrow < Q >  + Ord , 
2735-         Q :  Ord , 
2724+         K :  Comparable < Q >  + Ord , 
27362725    { 
27372726        let  ( root,  dormant_root)  = DormantMutRef :: new ( & mut  self . root ) ; 
27382727        let  root_node = match  root. as_mut ( )  { 
@@ -2801,8 +2790,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
28012790#[ unstable( feature = "btree_cursors" ,  issue = "107540" ) ]  
28022791    pub  fn  upper_bound < Q :  ?Sized > ( & self ,  bound :  Bound < & Q > )  -> Cursor < ' _ ,  K ,  V > 
28032792    where 
2804-         K :  Borrow < Q >  + Ord , 
2805-         Q :  Ord , 
2793+         K :  Comparable < Q >  + Ord , 
28062794    { 
28072795        let  root_node = match  self . root . as_ref ( )  { 
28082796            None  => return  Cursor  {  current :  None ,  root :  None  } , 
@@ -2854,8 +2842,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
28542842#[ unstable( feature = "btree_cursors" ,  issue = "107540" ) ]  
28552843    pub  fn  upper_bound_mut < Q :  ?Sized > ( & mut  self ,  bound :  Bound < & Q > )  -> CursorMut < ' _ ,  K ,  V ,  A > 
28562844    where 
2857-         K :  Borrow < Q >  + Ord , 
2858-         Q :  Ord , 
2845+         K :  Comparable < Q >  + Ord , 
28592846    { 
28602847        let  ( root,  dormant_root)  = DormantMutRef :: new ( & mut  self . root ) ; 
28612848        let  root_node = match  root. as_mut ( )  { 
0 commit comments