File tree 1 file changed +32
-0
lines changed
library/alloc/src/collections/btree/set
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use super::super::testing::rng::DeterministicRng;
3
3
use super :: * ;
4
4
use crate :: vec:: Vec ;
5
5
use std:: cmp:: Ordering ;
6
+ use std:: hash:: { Hash , Hasher } ;
6
7
use std:: iter:: FromIterator ;
7
8
use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
8
9
@@ -607,6 +608,37 @@ fn assert_send() {
607
608
}
608
609
}
609
610
611
+ #[ allow( dead_code) ]
612
+ // Check that the member-like functions conditionally provided by #[derive()]
613
+ // are not overriden by genuine member functions with a different signature.
614
+ fn assert_derives ( ) {
615
+ fn hash < T : Hash , H : Hasher > ( v : BTreeSet < T > , state : & mut H ) {
616
+ v. hash ( state) ;
617
+ // Tested much more thoroughly outside the crate in btree_set_hash.rs
618
+ }
619
+ fn eq < T : PartialEq > ( v : BTreeSet < T > ) {
620
+ let _ = v. eq ( & v) ;
621
+ }
622
+ fn ne < T : PartialEq > ( v : BTreeSet < T > ) {
623
+ let _ = v. ne ( & v) ;
624
+ }
625
+ fn cmp < T : Ord > ( v : BTreeSet < T > ) {
626
+ let _ = v. cmp ( & v) ;
627
+ }
628
+ fn min < T : Ord > ( v : BTreeSet < T > , w : BTreeSet < T > ) {
629
+ let _ = v. min ( w) ;
630
+ }
631
+ fn max < T : Ord > ( v : BTreeSet < T > , w : BTreeSet < T > ) {
632
+ let _ = v. max ( w) ;
633
+ }
634
+ fn clamp < T : Ord > ( v : BTreeSet < T > , w : BTreeSet < T > , x : BTreeSet < T > ) {
635
+ let _ = v. clamp ( w, x) ;
636
+ }
637
+ fn partial_cmp < T : PartialOrd > ( v : & BTreeSet < T > ) {
638
+ let _ = v. partial_cmp ( & v) ;
639
+ }
640
+ }
641
+
610
642
#[ test]
611
643
fn test_ord_absence ( ) {
612
644
fn set < K > ( mut set : BTreeSet < K > ) {
You can’t perform that action at this time.
0 commit comments