@@ -955,6 +955,8 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
955
955
let variant_def = adt_def. struct_variant ( ) ;
956
956
use rustc:: ty:: layout:: Layout :: * ;
957
957
match * self . type_layout ( ty) ? {
958
+ UntaggedUnion { ref variants } =>
959
+ Ok ( TyAndPacked { ty : variant_def. fields [ field_index] . ty ( self . tcx , substs) , packed : variants. packed } ) ,
958
960
Univariant { ref variant, .. } =>
959
961
Ok ( TyAndPacked { ty : variant_def. fields [ field_index] . ty ( self . tcx , substs) , packed : variant. packed } ) ,
960
962
_ => Err ( EvalError :: Unimplemented ( format ! ( "get_field_ty can't handle struct type: {:?}, {:?}" , ty, ty. sty) ) ) ,
@@ -988,8 +990,9 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
988
990
StructWrappedNullablePointer { ref nonnull, .. } => {
989
991
Ok ( nonnull. offsets [ field_index] )
990
992
}
993
+ UntaggedUnion { .. } => Ok ( Size :: from_bytes ( 0 ) ) ,
991
994
_ => {
992
- let msg = format ! ( "can't handle type: {:?}, with layout: {:?}" , ty, layout) ;
995
+ let msg = format ! ( "get_field_offset: can't handle type: {:?}, with layout: {:?}" , ty, layout) ;
993
996
Err ( EvalError :: Unimplemented ( msg) )
994
997
}
995
998
}
@@ -1006,8 +1009,9 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
1006
1009
Vector { count , .. } |
1007
1010
Array { count, .. } => Ok ( count) ,
1008
1011
Scalar { .. } => Ok ( 0 ) ,
1012
+ UntaggedUnion { .. } => Ok ( 1 ) ,
1009
1013
_ => {
1010
- let msg = format ! ( "can't handle type: {:?}, with layout: {:?}" , ty, layout) ;
1014
+ let msg = format ! ( "get_field_count: can't handle type: {:?}, with layout: {:?}" , ty, layout) ;
1011
1015
Err ( EvalError :: Unimplemented ( msg) )
1012
1016
}
1013
1017
}
0 commit comments