@@ -1495,7 +1495,7 @@ impl Type {
1495
1495
///
1496
1496
/// An owned type is also the same as its borrowed variants (this is commutative),
1497
1497
/// but `&T` is not the same as `&mut T`.
1498
- pub ( crate ) fn is_same ( & self , other : & Self , cache : & Cache ) -> bool {
1498
+ pub ( crate ) fn is_doc_subtype_of ( & self , other : & Self , cache : & Cache ) -> bool {
1499
1499
let ( self_cleared, other_cleared) = if !self . is_borrowed_ref ( ) || !other. is_borrowed_ref ( ) {
1500
1500
( self . without_borrowed_ref ( ) , other. without_borrowed_ref ( ) )
1501
1501
} else {
@@ -1504,17 +1504,17 @@ impl Type {
1504
1504
match ( self_cleared, other_cleared) {
1505
1505
// Recursive cases.
1506
1506
( Type :: Tuple ( a) , Type :: Tuple ( b) ) => {
1507
- a. len ( ) == b. len ( ) && a. iter ( ) . zip ( b) . all ( |( a, b) | a. is_same ( b, cache) )
1507
+ a. len ( ) == b. len ( ) && a. iter ( ) . zip ( b) . all ( |( a, b) | a. is_doc_subtype_of ( b, cache) )
1508
1508
}
1509
- ( Type :: Slice ( a) , Type :: Slice ( b) ) => a. is_same ( b, cache) ,
1510
- ( Type :: Array ( a, al) , Type :: Array ( b, bl) ) => al == bl && a. is_same ( b, cache) ,
1509
+ ( Type :: Slice ( a) , Type :: Slice ( b) ) => a. is_doc_subtype_of ( b, cache) ,
1510
+ ( Type :: Array ( a, al) , Type :: Array ( b, bl) ) => al == bl && a. is_doc_subtype_of ( b, cache) ,
1511
1511
( Type :: RawPointer ( mutability, type_) , Type :: RawPointer ( b_mutability, b_type_) ) => {
1512
- mutability == b_mutability && type_. is_same ( b_type_, cache)
1512
+ mutability == b_mutability && type_. is_doc_subtype_of ( b_type_, cache)
1513
1513
}
1514
1514
(
1515
1515
Type :: BorrowedRef { mutability, type_, .. } ,
1516
1516
Type :: BorrowedRef { mutability : b_mutability, type_ : b_type_, .. } ,
1517
- ) => mutability == b_mutability && type_. is_same ( b_type_, cache) ,
1517
+ ) => mutability == b_mutability && type_. is_doc_subtype_of ( b_type_, cache) ,
1518
1518
// Placeholders are equal to all other types.
1519
1519
( Type :: Infer , _) | ( _, Type :: Infer ) => true ,
1520
1520
// Generics match everything on the right, but not on the left.
@@ -1526,7 +1526,7 @@ impl Type {
1526
1526
&& a. generics ( )
1527
1527
. zip ( b. generics ( ) )
1528
1528
. map ( |( ag, bg) | {
1529
- ag. iter ( ) . zip ( bg. iter ( ) ) . all ( |( at, bt) | at. is_same ( bt, cache) )
1529
+ ag. iter ( ) . zip ( bg. iter ( ) ) . all ( |( at, bt) | at. is_doc_subtype_of ( bt, cache) )
1530
1530
} )
1531
1531
. unwrap_or ( true )
1532
1532
}
0 commit comments