pub(crate) fn field_types_query(
    db: &dyn HirDatabase,
    variant_id: VariantId,
) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>> {
    let var_data = variant_data(db.upcast(), variant_id);
    let (resolver, def): (_, GenericDefId) = match variant_id {
        VariantId::StructId(it) => (it.resolver(db.upcast()), it.into()),
        VariantId::UnionId(it) => (it.resolver(db.upcast()), it.into()),
        VariantId::EnumVariantId(it) => (it.parent.resolver(db.upcast()), it.parent.into()),
    };
    let generics = generics(db.upcast(), def);
    let mut res = ArenaMap::default();
    let ctx =
        TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable);
    for (field_id, field_data) in var_data.fields().iter() {
        res.insert(field_id, Binders::new(generics.len(), Ty::from_hir(&ctx, &field_data.type_ref)))
    }
    Arc::new(res)
}
/// Build the type of all specific fields of a struct or enum variant.
Build the type of all specific fields of a struct or enum variant.
Build the type of all specific fields of a struct or enum variant .
pub(crate) fn field_types_query(
    db: &dyn HirDatabase,
    variant_id: VariantId,
) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>> {
    let var_data = variant_data(db.upcast(), variant_id);
    let (resolver, def): (_, GenericDefId) = match variant_id {
        VariantId::StructId(it) => (it.resolver(db.upcast()), it.into()),
        VariantId::UnionId(it) => (it.resolver(db.upcast()), it.into()),
        VariantId::EnumVariantId(it) => (it.parent.resolver(db.upcast()), it.parent.into()),
    };
    let generics = generics(db.upcast(), def);
    let mut res = ArenaMap::default();
    let ctx =
        TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable);
    for (field_id, field_data) in var_data.fields().iter() {
        res.insert(field_id, Binders::new(generics.len(), Ty::from_hir(&ctx, &field_data.type_ref)))
    }
    Arc::new(res)
}
pub ( crate ) fn field_types_query ( db : & dyn HirDatabase , variant_id : VariantId , ) -> Arc < ArenaMap < LocalFieldId , Binders < Ty > > > { let var_data = variant_data ( db . upcast ( ) , variant_id ) ; let ( resolver , def ) : ( _ , GenericDefId ) = match variant_id { VariantId :: StructId ( it ) => ( it . resolver ( db . upcast ( ) ) , it . into ( ) ) , VariantId :: UnionId ( it ) => ( it . resolver ( db . upcast ( ) ) , it . into ( ) ) , VariantId :: EnumVariantId ( it ) => ( it . parent . resolver ( db . upcast ( ) ) , it . parent . into ( ) ) , } ; let generics = generics ( db . upcast ( ) , def ) ; let mut res = ArenaMap :: default ( ) ; let ctx = TyLoweringContext :: new ( db , & resolver ) . with_type_param_mode ( TypeParamLoweringMode :: Variable ) ; for ( field_id , field_data ) in var_data . fields ( ) . iter ( ) { res . insert ( field_id , Binders :: new ( generics . len ( ) , Ty :: from_hir ( & ctx , & field_data . type_ref ) ) ) } Arc :: new ( res ) }
Build the type of all specific fields of a struct or enum variant.
Build the type of all specific fields of a struct or enum variant .
db
&dyn HirDatabase
variant_id
VariantId