Skip to content

Commit e357be6

Browse files
committed
---
yaml --- r: 58037 b: refs/heads/snap-stage3 c: 984180c h: refs/heads/master i: 58035: 5172cff v: v3
1 parent 80f70c7 commit e357be6

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2ae44a07a9d508d0ad413e70d3152a0f4a087976
4+
refs/heads/snap-stage3: 984180c600b083b272237c0b343bb3e3dd844086
55
refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,12 +2499,15 @@ pub fn type_is_enum(ty: t) -> bool {
24992499
// constructors
25002500
pub fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
25012501
match get(ty).sty {
2502-
ty_enum(did, _) => {
2503-
let variants = enum_variants(cx, did);
2504-
let some_n_ary = vec::any(*variants, |v| vec::len(v.args) > 0u);
2505-
return !some_n_ary;
2506-
}
2507-
_ => return false
2502+
ty_enum(did, _) => {
2503+
let variants = enum_variants(cx, did);
2504+
if variants.len() == 0 {
2505+
false
2506+
} else {
2507+
variants.all(|v| v.args.len() == 0)
2508+
}
2509+
}
2510+
_ => false
25082511
}
25092512
}
25102513
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enum E {}
2+
3+
fn f(e: E) {
4+
println((e as int).to_str()); //~ ERROR non-scalar cast
5+
}
6+
7+
fn main() {}

0 commit comments

Comments
 (0)