@@ -1684,21 +1684,15 @@ tag scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
1684
1684
1685
1685
fn compare_scalar_types ( cx : @block_ctxt , lhs : ValueRef , rhs : ValueRef ,
1686
1686
t : & ty:: t , llop : ValueRef ) -> result {
1687
- // FIXME: this could be a lot shorter if we could combine multiple cases
1688
- // of alt expressions (issue #449).
1689
-
1690
1687
let f = bind compare_scalar_values ( cx, lhs, rhs, _, llop) ;
1691
1688
1692
-
1693
1689
alt ty:: struct ( bcx_tcx ( cx) , t) {
1694
1690
ty:: ty_nil. { ret f ( nil_type) ; }
1695
- ty:: ty_bool. { ret f ( unsigned_int) ; }
1691
+ ty:: ty_bool. | ty:: ty_uint. | ty:: ty_ptr ( _) |
1692
+ ty:: ty_char. { ret f ( unsigned_int) ; }
1696
1693
ty:: ty_int. { ret f ( signed_int) ; }
1697
1694
ty:: ty_float. { ret f( floating_point) ; }
1698
- ty:: ty_uint. { ret f ( unsigned_int) ; }
1699
1695
ty:: ty_machine ( _) {
1700
-
1701
-
1702
1696
if ty:: type_is_fp ( bcx_tcx ( cx) , t) {
1703
1697
// Floating point machine types
1704
1698
ret f( floating_point) ;
@@ -1710,7 +1704,6 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef,
1710
1704
ret f( unsigned_int) ;
1711
1705
}
1712
1706
}
1713
- ty:: ty_char. { ret f( unsigned_int) ; }
1714
1707
ty:: ty_type. {
1715
1708
trans_fail ( cx, none[ span] , "attempt to compare values of type type" ) ;
1716
1709
@@ -1724,7 +1717,6 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef,
1724
1717
"attempt to compare values of type native" ) ;
1725
1718
ret rslt( new_sub_block_ctxt ( cx, "after_fail_dummy" ) , C_bool ( false ) ) ;
1726
1719
}
1727
- ty:: ty_ptr ( _) { ret f( unsigned_int) ; }
1728
1720
_ {
1729
1721
// Should never get here, because t is scalar.
1730
1722
bcx_ccx ( cx) . sess . bug ( "non-scalar type passed to \
0 commit comments