File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -1496,6 +1496,8 @@ impl Type {
14961496 /// An owned type is also the same as its borrowed variants (this is commutative),
14971497 /// but `&T` is not the same as `&mut T`.
14981498 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.
14991501 let ( self_cleared, other_cleared) = if !self . is_borrowed_ref ( ) || !other. is_borrowed_ref ( ) {
15001502 ( self . without_borrowed_ref ( ) , other. without_borrowed_ref ( ) )
15011503 } else {
@@ -1518,6 +1520,7 @@ impl Type {
15181520 // Placeholders are equal to all other types.
15191521 ( Type :: Infer , _) | ( _, Type :: Infer ) => true ,
15201522 // Generics match everything on the right, but not on the left.
1523+ // If both sides are generic, this returns true.
15211524 ( _, Type :: Generic ( _) ) => true ,
15221525 ( Type :: Generic ( _) , _) => false ,
15231526 // Paths account for both the path itself and its generics.
You can’t perform that action at this time.
0 commit comments