@@ -18,7 +18,6 @@ use std::sync::Arc;
18
18
19
19
use chalk_ir:: { cast:: Cast , ConstValue , DebruijnIndex , Mutability , Safety , Scalar , TypeFlags } ;
20
20
use hir_def:: {
21
- adt:: { ReprData , ReprKind } ,
22
21
body:: Body ,
23
22
builtin_type:: BuiltinType ,
24
23
data:: { ConstData , StaticData } ,
@@ -70,15 +69,10 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
70
69
DefWithBodyId :: FunctionId ( f) => ctx. collect_fn ( f) ,
71
70
DefWithBodyId :: StaticId ( s) => ctx. collect_static ( & db. static_data ( s) ) ,
72
71
DefWithBodyId :: VariantId ( v) => {
73
- ctx. return_ty = match db. enum_data ( v. parent ) . repr {
74
- Some ( ReprData { kind : ReprKind :: BuiltinInt { builtin, .. } , .. } ) => {
75
- TyBuilder :: builtin ( match builtin {
76
- Either :: Left ( builtin) => BuiltinType :: Int ( builtin) ,
77
- Either :: Right ( builtin) => BuiltinType :: Uint ( builtin) ,
78
- } )
79
- }
80
- _ => TyBuilder :: builtin ( BuiltinType :: Uint ( hir_def:: builtin_type:: BuiltinUint :: U32 ) ) ,
81
- } ;
72
+ ctx. return_ty = TyBuilder :: builtin ( match db. enum_data ( v. parent ) . variant_body_type ( ) {
73
+ Either :: Left ( builtin) => BuiltinType :: Int ( builtin) ,
74
+ Either :: Right ( builtin) => BuiltinType :: Uint ( builtin) ,
75
+ } ) ;
82
76
}
83
77
}
84
78
0 commit comments