@@ -117,15 +117,14 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
117117
118118 fn adt_datum (
119119 & self ,
120- struct_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
120+ adt_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
121121 ) -> Arc < chalk_solve:: rust_ir:: AdtDatum < RustInterner < ' tcx > > > {
122- let adt_def_id = struct_id. 0 ;
123- let adt_def = self . tcx . adt_def ( adt_def_id) ;
122+ let adt_def = adt_id. 0 ;
124123
125- let bound_vars = bound_vars_for_item ( self . tcx , adt_def_id ) ;
124+ let bound_vars = bound_vars_for_item ( self . tcx , adt_def . did ) ;
126125 let binders = binders_for ( & self . interner , bound_vars) ;
127126
128- let predicates = self . tcx . predicates_of ( adt_def_id ) . predicates ;
127+ let predicates = self . tcx . predicates_of ( adt_def . did ) . predicates ;
129128 let where_clauses: Vec < _ > = predicates
130129 . into_iter ( )
131130 . map ( |( wc, _) | wc. subst ( self . tcx , bound_vars) )
@@ -149,13 +148,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
149148 ty:: AdtKind :: Enum => vec ! [ ] ,
150149 } ;
151150 let struct_datum = Arc :: new ( chalk_solve:: rust_ir:: AdtDatum {
152- id : struct_id ,
151+ id : adt_id ,
153152 binders : chalk_ir:: Binders :: new (
154153 binders,
155154 chalk_solve:: rust_ir:: AdtDatumBound { fields, where_clauses } ,
156155 ) ,
157156 flags : chalk_solve:: rust_ir:: AdtFlags {
158- upstream : !adt_def_id . is_local ( ) ,
157+ upstream : !adt_def . did . is_local ( ) ,
159158 fundamental : adt_def. is_fundamental ( ) ,
160159 } ,
161160 } ) ;
@@ -179,7 +178,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
179178 let sig = self . tcx . fn_sig ( def_id) ;
180179 // FIXME(chalk): collect into an intermediate SmallVec here since
181180 // we need `TypeFoldable` for `no_bound_vars`
182- let argument_types: Binder < Vec < _ > > = sig. map_bound ( |i| i. inputs ( ) . iter ( ) . copied ( ) . collect ( ) ) ;
181+ let argument_types: Binder < Vec < _ > > =
182+ sig. map_bound ( |i| i. inputs ( ) . iter ( ) . copied ( ) . collect ( ) ) ;
183183 let argument_types = argument_types
184184 . no_bound_vars ( )
185185 . expect ( "FIXME(chalk): late-bound fn parameters not supported in chalk" )
@@ -259,17 +259,17 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
259259 fn impl_provided_for (
260260 & self ,
261261 auto_trait_id : chalk_ir:: TraitId < RustInterner < ' tcx > > ,
262- struct_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
262+ adt_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
263263 ) -> bool {
264264 let trait_def_id = auto_trait_id. 0 ;
265- let adt_def_id = struct_id . 0 ;
265+ let adt_def = adt_id . 0 ;
266266 let all_impls = self . tcx . all_impls ( trait_def_id) ;
267267 for impl_def_id in all_impls {
268268 let trait_ref = self . tcx . impl_trait_ref ( impl_def_id) . unwrap ( ) ;
269269 let self_ty = trait_ref. self_ty ( ) ;
270270 match self_ty. kind {
271- ty:: Adt ( adt_def , _) => {
272- if adt_def . did == adt_def_id {
271+ ty:: Adt ( impl_adt_def , _) => {
272+ if impl_adt_def == adt_def {
273273 return true ;
274274 }
275275 }
@@ -344,16 +344,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
344344 match well_known {
345345 chalk_solve:: rust_ir:: WellKnownTrait :: SizedTrait => match ty {
346346 Apply ( apply) => match apply. name {
347- chalk_ir:: TypeName :: Adt ( chalk_ir:: AdtId ( adt_def_id) ) => {
348- let adt_def = self . tcx . adt_def ( adt_def_id) ;
349- match adt_def. adt_kind ( ) {
350- ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
351- ty:: AdtKind :: Enum => {
352- let constraint = self . tcx . adt_sized_constraint ( adt_def_id) ;
353- if constraint. 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) }
354- }
347+ chalk_ir:: TypeName :: Adt ( chalk_ir:: AdtId ( adt_def) ) => match adt_def. adt_kind ( ) {
348+ ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
349+ ty:: AdtKind :: Enum => {
350+ let constraint = self . tcx . adt_sized_constraint ( adt_def. did ) ;
351+ if constraint. 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) }
355352 }
356- }
353+ } ,
357354 _ => None ,
358355 } ,
359356 Dyn ( _)
@@ -366,16 +363,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
366363 chalk_solve:: rust_ir:: WellKnownTrait :: CopyTrait
367364 | chalk_solve:: rust_ir:: WellKnownTrait :: CloneTrait => match ty {
368365 Apply ( apply) => match apply. name {
369- chalk_ir:: TypeName :: Adt ( chalk_ir:: AdtId ( adt_def_id) ) => {
370- let adt_def = self . tcx . adt_def ( adt_def_id) ;
371- match adt_def. adt_kind ( ) {
372- ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
373- ty:: AdtKind :: Enum => {
374- let constraint = self . tcx . adt_sized_constraint ( adt_def_id) ;
375- if constraint. 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) }
376- }
366+ chalk_ir:: TypeName :: Adt ( chalk_ir:: AdtId ( adt_def) ) => match adt_def. adt_kind ( ) {
367+ ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
368+ ty:: AdtKind :: Enum => {
369+ let constraint = self . tcx . adt_sized_constraint ( adt_def. did ) ;
370+ if constraint. 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) }
377371 }
378- }
372+ } ,
379373 _ => None ,
380374 } ,
381375 Dyn ( _)
0 commit comments