@@ -3039,6 +3039,10 @@ pub fn mk_nil<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
3039
3039
mk_tup ( cx, Vec :: new ( ) )
3040
3040
}
3041
3041
3042
+ pub fn mk_bool < ' tcx > ( cx : & ctxt < ' tcx > ) -> Ty < ' tcx > {
3043
+ mk_t ( cx, ty_bool)
3044
+ }
3045
+
3042
3046
pub fn mk_bare_fn < ' tcx > ( cx : & ctxt < ' tcx > ,
3043
3047
opt_def_id : Option < ast:: DefId > ,
3044
3048
fty : & ' tcx BareFnTy < ' tcx > ) -> Ty < ' tcx > {
@@ -3406,8 +3410,12 @@ pub fn type_is_scalar(ty: Ty) -> bool {
3406
3410
/// Returns true if this type is a floating point type and false otherwise.
3407
3411
pub fn type_is_floating_point ( ty : Ty ) -> bool {
3408
3412
match ty. sty {
3409
- ty_float( _) => true ,
3410
- _ => false ,
3413
+ ty_float( _) |
3414
+ ty_infer( FloatVar ( _) ) =>
3415
+ true ,
3416
+
3417
+ _ =>
3418
+ false ,
3411
3419
}
3412
3420
}
3413
3421
@@ -5805,78 +5813,6 @@ pub fn closure_upvars<'tcx>(typer: &mc::Typer<'tcx>,
5805
5813
}
5806
5814
}
5807
5815
5808
- pub fn is_binopable < ' tcx > ( cx : & ctxt < ' tcx > , ty : Ty < ' tcx > , op : ast:: BinOp ) -> bool {
5809
- #![ allow( non_upper_case_globals) ]
5810
- const tycat_other: isize = 0 ;
5811
- const tycat_bool: isize = 1 ;
5812
- const tycat_char: isize = 2 ;
5813
- const tycat_int: isize = 3 ;
5814
- const tycat_float: isize = 4 ;
5815
- const tycat_raw_ptr: isize = 6 ;
5816
-
5817
- const opcat_add: isize = 0 ;
5818
- const opcat_sub: isize = 1 ;
5819
- const opcat_mult: isize = 2 ;
5820
- const opcat_shift: isize = 3 ;
5821
- const opcat_rel: isize = 4 ;
5822
- const opcat_eq: isize = 5 ;
5823
- const opcat_bit: isize = 6 ;
5824
- const opcat_logic: isize = 7 ;
5825
- const opcat_mod: isize = 8 ;
5826
-
5827
- fn opcat ( op : ast:: BinOp ) -> isize {
5828
- match op. node {
5829
- ast:: BiAdd => opcat_add,
5830
- ast:: BiSub => opcat_sub,
5831
- ast:: BiMul => opcat_mult,
5832
- ast:: BiDiv => opcat_mult,
5833
- ast:: BiRem => opcat_mod,
5834
- ast:: BiAnd => opcat_logic,
5835
- ast:: BiOr => opcat_logic,
5836
- ast:: BiBitXor => opcat_bit,
5837
- ast:: BiBitAnd => opcat_bit,
5838
- ast:: BiBitOr => opcat_bit,
5839
- ast:: BiShl => opcat_shift,
5840
- ast:: BiShr => opcat_shift,
5841
- ast:: BiEq => opcat_eq,
5842
- ast:: BiNe => opcat_eq,
5843
- ast:: BiLt => opcat_rel,
5844
- ast:: BiLe => opcat_rel,
5845
- ast:: BiGe => opcat_rel,
5846
- ast:: BiGt => opcat_rel
5847
- }
5848
- }
5849
-
5850
- fn tycat < ' tcx > ( cx : & ctxt < ' tcx > , ty : Ty < ' tcx > ) -> isize {
5851
- if type_is_simd ( cx, ty) {
5852
- return tycat ( cx, simd_type ( cx, ty) )
5853
- }
5854
- match ty. sty {
5855
- ty_char => tycat_char,
5856
- ty_bool => tycat_bool,
5857
- ty_int( _) | ty_uint( _) | ty_infer( IntVar ( _) ) => tycat_int,
5858
- ty_float( _) | ty_infer( FloatVar ( _) ) => tycat_float,
5859
- ty_ptr( _) => tycat_raw_ptr,
5860
- _ => tycat_other
5861
- }
5862
- }
5863
-
5864
- const t: bool = true ;
5865
- const f: bool = false ;
5866
-
5867
- let tbl = [
5868
- // +, -, *, shift, rel, ==, bit, logic, mod
5869
- /*other*/ [ f, f, f, f, f, f, f, f, f] ,
5870
- /*bool*/ [ f, f, f, f, t, t, t, t, f] ,
5871
- /*char*/ [ f, f, f, f, t, t, f, f, f] ,
5872
- /*isize*/ [ t, t, t, t, t, t, t, f, t] ,
5873
- /*float*/ [ t, t, t, f, t, t, f, f, f] ,
5874
- /*bot*/ [ t, t, t, t, t, t, t, t, t] ,
5875
- /*raw ptr*/ [ f, f, f, f, t, t, f, f, f] ] ;
5876
-
5877
- return tbl[ tycat ( cx, ty) as usize ] [ opcat ( op) as usize ] ;
5878
- }
5879
-
5880
5816
// Returns the repeat count for a repeating vector expression.
5881
5817
pub fn eval_repeat_count ( tcx : & ctxt , count_expr : & ast:: Expr ) -> usize {
5882
5818
match const_eval:: eval_const_expr_partial ( tcx, count_expr, Some ( tcx. types . usize ) ) {
0 commit comments