@@ -26,7 +26,6 @@ use cabi_asmjs;
2626use machine:: { llalign_of_min, llsize_of, llsize_of_real, llsize_of_store} ;
2727use type_:: Type ;
2828use type_of;
29- use adt;
3029
3130use rustc:: hir;
3231use rustc:: ty:: { self , Ty } ;
@@ -36,6 +35,7 @@ use std::cmp;
3635
3736pub use syntax:: abi:: Abi ;
3837pub use rustc:: ty:: layout:: { FAT_PTR_ADDR , FAT_PTR_EXTRA } ;
38+ use rustc:: ty:: layout:: Layout ;
3939
4040#[ derive( Clone , Copy , PartialEq , Debug ) ]
4141enum ArgKind {
@@ -318,13 +318,10 @@ impl FnType {
318318 if ty. is_integral ( ) {
319319 arg. signedness = Some ( ty. is_signed ( ) ) ;
320320 }
321- // Rust enum types that map onto C enums (LLVM integers) also
322- // need to follow the target ABI zero-/sign-extension rules.
323- if let ty:: TyEnum ( ..) = ty. sty {
324- if arg. ty . kind ( ) == llvm:: Integer {
325- let repr = adt:: represent_type ( ccx, ty) ;
326- arg. signedness = Some ( adt:: is_discr_signed ( & repr) ) ;
327- }
321+ // Rust enum types that map onto C enums also need to follow
322+ // the target ABI zero-/sign-extension rules.
323+ if let Layout :: CEnum { signed, .. } = * ccx. layout_of ( ty) {
324+ arg. signedness = Some ( signed) ;
328325 }
329326 if llsize_of_real ( ccx, arg. ty ) == 0 {
330327 // For some forsaken reason, x86_64-pc-windows-gnu
0 commit comments