File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: 0cf6b613d1d1086e437098207e6790b99b5a9220
5
+ refs/heads/try: ab4105d9e8b7c0719343aa2e4edd15cae0b7c947
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -1072,12 +1072,17 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
1072
1072
// Enums lower to the lowest of their variants.
1073
1073
ty_enum ( did, tps) {
1074
1074
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) == 0 u {
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
+ }
1081
1086
}
1082
1087
}
1083
1088
lowest
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments