Skip to content

Commit 711fc20

Browse files
committed
Merge pull request #1544 from kevina/issue-1393
Minor cleanups to custom discriminator code.
2 parents c4553ca + bdc8e8d commit 711fc20

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

doc/tutorial/data.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ equivalent to a C enum:
103103
This will define `north`, `east`, `south`, and `west` as constants,
104104
all of which have type `direction`.
105105

106-
When the enum is is C like, that is none of the variants have
107-
parameters, it is possible to explicit set the discriminator values to
108-
an integer value:
106+
When the enum is C like, that is none of the variants have parameters,
107+
it is possible to explicitly set the discriminator values to an integer
108+
value:
109109

110110
enum color {
111111
red = 0xff0000;

src/comp/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,8 +2645,8 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @[variant_info] {
26452645
@csearch::get_tag_variants(cx, id)
26462646
} else {
26472647
// FIXME: Now that the variants are run through the type checker (to
2648-
// check the disr_expr if one exists), this code should likely be
2649-
// moved there to avoid having to call eval_const_expr twice
2648+
// check the disr_expr if it exists), this code should likely be
2649+
// moved there to avoid having to call eval_const_expr twice.
26502650
alt cx.items.get(id.node) {
26512651
ast_map::node_item(@{node: ast::item_tag(variants, _), _}) {
26522652
let disr_val = -1;

src/comp/middle/typeck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,8 +2489,8 @@ fn check_tag_variants(ccx: @crate_ctxt, _sp: span, vs: [ast::variant],
24892489
demand::simple(fcx, e.span, declty, cty);
24902490
// FIXME: issue #1417
24912491
// Also, check_expr (from check_const pass) doesn't guarantee that
2492-
// the expression in an form that eval_const_expr, so we may still
2493-
// get an internal compiler error
2492+
// the expression in an form that eval_const_expr can handle, so
2493+
// we may still get an internal compiler error.
24942494
alt syntax::ast_util::eval_const_expr(e) {
24952495
syntax::ast_util::const_int(val) {
24962496
disr_val = val as int;

src/test/run-pass/enum-disr-val-pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99
test_color(imaginary, -1, "imaginary");
1010
}
1111

12-
fn test_color(color: color, val: int, name: str) unsafe{
12+
fn test_color(color: color, val: int, name: str) {
1313
assert (color as int == val);
1414
assert (color as float == val as float);
1515
}

0 commit comments

Comments
 (0)