@@ -144,10 +144,11 @@ export kind_is_durable;
144
144
export meta_kind, kind_lteq, type_kind, type_kind_ext;
145
145
export operators;
146
146
export type_err, terr_vstore_kind;
147
- export terr_mismatch, terr_onceness_mismatch;
147
+ export terr_integer_as_char , terr_mismatch, terr_onceness_mismatch;
148
148
export type_err_to_str, note_and_explain_type_err;
149
149
export expected_found;
150
150
export type_needs_drop;
151
+ export type_is_char;
151
152
export type_is_empty;
152
153
export type_is_integral;
153
154
export type_is_numeric;
@@ -696,6 +697,7 @@ enum type_err {
696
697
terr_in_field( @type_err , ast:: ident ) ,
697
698
terr_sorts( expected_found < t > ) ,
698
699
terr_self_substs,
700
+ terr_integer_as_char,
699
701
terr_no_integral_type,
700
702
terr_no_floating_point_type,
701
703
}
@@ -2520,6 +2522,13 @@ fn type_is_integral(ty: t) -> bool {
2520
2522
}
2521
2523
}
2522
2524
2525
+ fn type_is_char(ty: t) -> bool {
2526
+ match get(ty).sty {
2527
+ ty_int(ty_char) => true,
2528
+ _ => false
2529
+ }
2530
+ }
2531
+
2523
2532
fn type_is_fp(ty: t) -> bool {
2524
2533
match get(ty).sty {
2525
2534
ty_infer(FloatVar(_)) | ty_float(_) => true,
@@ -3489,6 +3498,10 @@ fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
3489
3498
~"couldn' t determine an appropriate integral type for integer \
3490
3499
literal"
3491
3500
}
3501
+ terr_integer_as_char => {
3502
+ ~"integer literals can' t be inferred to char type \
3503
+ ( try an explicit cast) "
3504
+ }
3492
3505
terr_no_floating_point_type => {
3493
3506
~"couldn' t determine an appropriate floating point type for \
3494
3507
floating point literal"
0 commit comments