@@ -162,10 +162,11 @@ export kind_is_durable;
162
162
export meta_kind, kind_lteq, type_kind, type_kind_ext;
163
163
export operators;
164
164
export type_err, terr_vstore_kind;
165
- export terr_mismatch, terr_onceness_mismatch;
165
+ export terr_integer_as_char , terr_mismatch, terr_onceness_mismatch;
166
166
export type_err_to_str, note_and_explain_type_err;
167
167
export expected_found;
168
168
export type_needs_drop;
169
+ export type_is_char;
169
170
export type_is_empty;
170
171
export type_is_integral;
171
172
export type_is_numeric;
@@ -714,6 +715,7 @@ enum type_err {
714
715
terr_in_field( @type_err , ast:: ident ) ,
715
716
terr_sorts( expected_found < t > ) ,
716
717
terr_self_substs,
718
+ terr_integer_as_char,
717
719
terr_no_integral_type,
718
720
terr_no_floating_point_type,
719
721
}
@@ -2541,6 +2543,13 @@ fn type_is_integral(ty: t) -> bool {
2541
2543
}
2542
2544
}
2543
2545
2546
+ fn type_is_char(ty: t) -> bool {
2547
+ match get(ty).sty {
2548
+ ty_int(ty_char) => true,
2549
+ _ => false
2550
+ }
2551
+ }
2552
+
2544
2553
fn type_is_fp(ty: t) -> bool {
2545
2554
match get(ty).sty {
2546
2555
ty_infer(FloatVar(_)) | ty_float(_) => true,
@@ -3510,6 +3519,10 @@ fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
3510
3519
~"couldn' t determine an appropriate integral type for integer \
3511
3520
literal"
3512
3521
}
3522
+ terr_integer_as_char => {
3523
+ ~"integer literals can' t be inferred to char type \
3524
+ ( try an explicit cast) "
3525
+ }
3513
3526
terr_no_floating_point_type => {
3514
3527
~"couldn' t determine an appropriate floating point type for \
3515
3528
floating point literal"
0 commit comments