File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 2ae44a07a9d508d0ad413e70d3152a0f4a087976
4
+ refs/heads/snap-stage3: 984180c600b083b272237c0b343bb3e3dd844086
5
5
refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -2499,12 +2499,15 @@ pub fn type_is_enum(ty: t) -> bool {
2499
2499
// constructors
2500
2500
pub fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
2501
2501
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
2508
2511
}
2509
2512
}
2510
2513
Original file line number Diff line number Diff line change
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 ( ) { }
You can’t perform that action at this time.
0 commit comments