File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -244,13 +244,17 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
244244 let id = from_chalk ( self . db , trait_id) ;
245245 self . db . trait_data ( id) . name . to_string ( )
246246 }
247- // FIXME: lookup names
248- fn adt_name ( & self , struct_id : chalk_ir:: AdtId < Interner > ) -> String {
249- let datum = self . db . struct_datum ( self . krate , struct_id) ;
250- format ! ( "{:?}" , datum. name( & Interner ) )
247+ fn adt_name ( & self , adt_id : chalk_ir:: AdtId < Interner > ) -> String {
248+ let id = from_chalk ( self . db , adt_id) ;
249+ match id {
250+ hir_def:: AdtId :: StructId ( id) => self . db . struct_data ( id) . name . to_string ( ) ,
251+ hir_def:: AdtId :: EnumId ( id) => self . db . enum_data ( id) . name . to_string ( ) ,
252+ hir_def:: AdtId :: UnionId ( id) => self . db . union_data ( id) . name . to_string ( ) ,
253+ }
251254 }
252255 fn assoc_type_name ( & self , assoc_ty_id : chalk_ir:: AssocTypeId < Interner > ) -> String {
253- format ! ( "Assoc_{}" , assoc_ty_id. 0 )
256+ let id = self . db . associated_ty_data ( assoc_ty_id) . name ;
257+ self . db . type_alias_data ( id) . name . to_string ( )
254258 }
255259 fn opaque_type_name ( & self , opaque_ty_id : chalk_ir:: OpaqueTyId < Interner > ) -> String {
256260 format ! ( "Opaque_{}" , opaque_ty_id. 0 )
Original file line number Diff line number Diff line change @@ -464,6 +464,18 @@ impl ToChalk for hir_def::ImplId {
464464 }
465465}
466466
467+ impl ToChalk for hir_def:: AdtId {
468+ type Chalk = AdtId ;
469+
470+ fn to_chalk ( self , _db : & dyn HirDatabase ) -> Self :: Chalk {
471+ chalk_ir:: AdtId ( self . into ( ) )
472+ }
473+
474+ fn from_chalk ( _db : & dyn HirDatabase , id : AdtId ) -> Self {
475+ id. 0
476+ }
477+ }
478+
467479impl ToChalk for CallableDefId {
468480 type Chalk = FnDefId ;
469481
You can’t perform that action at this time.
0 commit comments