Skip to content

Commit c5e84f5

Browse files
committed
---
yaml --- r: 15324 b: refs/heads/try c: ab4105d h: refs/heads/master v: v3
1 parent c480b33 commit c5e84f5

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 0cf6b613d1d1086e437098207e6790b99b5a9220
5+
refs/heads/try: ab4105d9e8b7c0719343aa2e4edd15cae0b7c947
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/ty.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,12 +1072,17 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
10721072
// Enums lower to the lowest of their variants.
10731073
ty_enum(did, tps) {
10741074
let mut lowest = kind_sendable;
1075-
for variant in *enum_variants(cx, did) {
1076-
for aty in variant.args {
1077-
// Perform any type parameter substitutions.
1078-
let arg_ty = substitute_type_params(cx, tps, aty);
1079-
lowest = lower_kind(lowest, type_kind(cx, arg_ty));
1080-
if lowest == kind_noncopyable { break; }
1075+
let variants = enum_variants(cx, did);
1076+
if vec::len(*variants) == 0u {
1077+
lowest = kind_noncopyable;
1078+
} else {
1079+
for variant in *variants {
1080+
for aty in variant.args {
1081+
// Perform any type parameter substitutions.
1082+
let arg_ty = substitute_type_params(cx, tps, aty);
1083+
lowest = lower_kind(lowest, type_kind(cx, arg_ty));
1084+
if lowest == kind_noncopyable { break; }
1085+
}
10811086
}
10821087
}
10831088
lowest
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
let x : *[int] = ptr::addr_of([1,2,3]);
3+
let y : *libc::c_void = x as *libc::c_void;
4+
unsafe {
5+
let _z = *y;
6+
//!^ ERROR copying a noncopyable value
7+
}
8+
}

0 commit comments

Comments
 (0)