File tree 1 file changed +3
-0
lines changed
1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -1496,6 +1496,8 @@ impl Type {
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
1498
pub ( crate ) fn is_doc_subtype_of ( & self , other : & Self , cache : & Cache ) -> bool {
1499
+ // Strip the references so that it can compare the actual types, unless both are references.
1500
+ // If both are references, leave them alone and compare the mutabilities later.
1499
1501
let ( self_cleared, other_cleared) = if !self . is_borrowed_ref ( ) || !other. is_borrowed_ref ( ) {
1500
1502
( self . without_borrowed_ref ( ) , other. without_borrowed_ref ( ) )
1501
1503
} else {
@@ -1518,6 +1520,7 @@ impl Type {
1518
1520
// Placeholders are equal to all other types.
1519
1521
( Type :: Infer , _) | ( _, Type :: Infer ) => true ,
1520
1522
// Generics match everything on the right, but not on the left.
1523
+ // If both sides are generic, this returns true.
1521
1524
( _, Type :: Generic ( _) ) => true ,
1522
1525
( Type :: Generic ( _) , _) => false ,
1523
1526
// Paths account for both the path itself and its generics.
You can’t perform that action at this time.
0 commit comments