Skip to content

Commit bdc8e8d

Browse files
committed
Minor cleanups to custom discriminator code.
Mostly updates to the comments and docs from Pull Request rust-lang#1537.
1 parent e20d906 commit bdc8e8d

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
@@ -2636,8 +2636,8 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @[variant_info] {
26362636
@csearch::get_tag_variants(cx, id)
26372637
} else {
26382638
// FIXME: Now that the variants are run through the type checker (to
2639-
// check the disr_expr if one exists), this code should likely be
2640-
// moved there to avoid having to call eval_const_expr twice
2639+
// check the disr_expr if it exists), this code should likely be
2640+
// moved there to avoid having to call eval_const_expr twice.
26412641
alt cx.items.get(id.node) {
26422642
ast_map::node_item(@{node: ast::item_tag(variants, _), _}) {
26432643
let disr_val = -1;

src/comp/middle/typeck.rs

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