@@ -18,7 +18,6 @@ use std::sync::Arc;
1818
1919use chalk_ir:: { cast:: Cast , ConstValue , DebruijnIndex , Mutability , Safety , Scalar , TypeFlags } ;
2020use hir_def:: {
21- adt:: { ReprData , ReprKind } ,
2221 body:: Body ,
2322 builtin_type:: BuiltinType ,
2423 data:: { ConstData , StaticData } ,
@@ -70,15 +69,10 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
7069 DefWithBodyId :: FunctionId ( f) => ctx. collect_fn ( f) ,
7170 DefWithBodyId :: StaticId ( s) => ctx. collect_static ( & db. static_data ( s) ) ,
7271 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+ } ) ;
8276 }
8377 }
8478
0 commit comments