@@ -330,7 +330,14 @@ impl<I: Interner> PartialEq for TyKind<I> {
330330 ( Placeholder ( a_p) , Placeholder ( b_p) ) => a_p == b_p,
331331 ( Infer ( a_t) , Infer ( b_t) ) => a_t == b_t,
332332 ( Error ( a_e) , Error ( b_e) ) => a_e == b_e,
333- _ => true , // unreachable
333+ ( Bool , Bool ) | ( Char , Char ) | ( Str , Str ) | ( Never , Never ) => true ,
334+ _ => {
335+ debug_assert ! (
336+ false ,
337+ "This branch must be unreachable, maybe the match is missing an arm? self = self = {self:?}, other = {other:?}"
338+ ) ;
339+ true
340+ }
334341 }
335342 }
336343}
@@ -381,7 +388,11 @@ impl<I: Interner> Ord for TyKind<I> {
381388 ( Placeholder ( a_p) , Placeholder ( b_p) ) => a_p. cmp ( b_p) ,
382389 ( Infer ( a_t) , Infer ( b_t) ) => a_t. cmp ( b_t) ,
383390 ( Error ( a_e) , Error ( b_e) ) => a_e. cmp ( b_e) ,
384- _ => Ordering :: Equal , // unreachable
391+ ( Bool , Bool ) | ( Char , Char ) | ( Str , Str ) | ( Never , Never ) => Ordering :: Equal ,
392+ _ => {
393+ debug_assert ! ( false , "This branch must be unreachable, maybe the match is missing an arm? self = self = {self:?}, other = {other:?}" ) ;
394+ Ordering :: Equal
395+ }
385396 }
386397 } )
387398 }
@@ -977,7 +988,13 @@ impl<I: Interner> PartialEq for RegionKind<I> {
977988 ( ReVar ( a_r) , ReVar ( b_r) ) => a_r == b_r,
978989 ( RePlaceholder ( a_r) , RePlaceholder ( b_r) ) => a_r == b_r,
979990 ( ReErased , ReErased ) => true ,
980- _ => true , // unreachable
991+ _ => {
992+ debug_assert ! (
993+ false ,
994+ "This branch must be unreachable, maybe the match is missing an arm? self = self = {self:?}, other = {other:?}"
995+ ) ;
996+ true
997+ }
981998 }
982999 }
9831000}
@@ -1008,7 +1025,10 @@ impl<I: Interner> Ord for RegionKind<I> {
10081025 ( ReVar ( a_r) , ReVar ( b_r) ) => a_r. cmp ( b_r) ,
10091026 ( RePlaceholder ( a_r) , RePlaceholder ( b_r) ) => a_r. cmp ( b_r) ,
10101027 ( ReErased , ReErased ) => Ordering :: Equal ,
1011- _ => Ordering :: Equal , // unreachable
1028+ _ => {
1029+ debug_assert ! ( false , "This branch must be unreachable, maybe the match is missing an arm? self = self = {self:?}, other = {other:?}" ) ;
1030+ Ordering :: Equal
1031+ }
10121032 }
10131033 } )
10141034 }
0 commit comments