@@ -117,15 +117,14 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
117
117
118
118
fn adt_datum (
119
119
& self ,
120
- struct_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
120
+ adt_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
121
121
) -> 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 ;
124
123
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 ) ;
126
125
let binders = binders_for ( & self . interner , bound_vars) ;
127
126
128
- let predicates = self . tcx . predicates_of ( adt_def_id ) . predicates ;
127
+ let predicates = self . tcx . predicates_of ( adt_def . did ) . predicates ;
129
128
let where_clauses: Vec < _ > = predicates
130
129
. into_iter ( )
131
130
. map ( |( wc, _) | wc. subst ( self . tcx , bound_vars) )
@@ -149,13 +148,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
149
148
ty:: AdtKind :: Enum => vec ! [ ] ,
150
149
} ;
151
150
let struct_datum = Arc :: new ( chalk_solve:: rust_ir:: AdtDatum {
152
- id : struct_id ,
151
+ id : adt_id ,
153
152
binders : chalk_ir:: Binders :: new (
154
153
binders,
155
154
chalk_solve:: rust_ir:: AdtDatumBound { fields, where_clauses } ,
156
155
) ,
157
156
flags : chalk_solve:: rust_ir:: AdtFlags {
158
- upstream : !adt_def_id . is_local ( ) ,
157
+ upstream : !adt_def . did . is_local ( ) ,
159
158
fundamental : adt_def. is_fundamental ( ) ,
160
159
} ,
161
160
} ) ;
@@ -179,7 +178,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
179
178
let sig = self . tcx . fn_sig ( def_id) ;
180
179
// FIXME(chalk): collect into an intermediate SmallVec here since
181
180
// 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 ( ) ) ;
183
183
let argument_types = argument_types
184
184
. no_bound_vars ( )
185
185
. 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
259
259
fn impl_provided_for (
260
260
& self ,
261
261
auto_trait_id : chalk_ir:: TraitId < RustInterner < ' tcx > > ,
262
- struct_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
262
+ adt_id : chalk_ir:: AdtId < RustInterner < ' tcx > > ,
263
263
) -> bool {
264
264
let trait_def_id = auto_trait_id. 0 ;
265
- let adt_def_id = struct_id . 0 ;
265
+ let adt_def = adt_id . 0 ;
266
266
let all_impls = self . tcx . all_impls ( trait_def_id) ;
267
267
for impl_def_id in all_impls {
268
268
let trait_ref = self . tcx . impl_trait_ref ( impl_def_id) . unwrap ( ) ;
269
269
let self_ty = trait_ref. self_ty ( ) ;
270
270
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 {
273
273
return true ;
274
274
}
275
275
}
@@ -344,16 +344,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
344
344
match well_known {
345
345
chalk_solve:: rust_ir:: WellKnownTrait :: SizedTrait => match ty {
346
346
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 ) }
355
352
}
356
- }
353
+ } ,
357
354
_ => None ,
358
355
} ,
359
356
Dyn ( _)
@@ -366,16 +363,13 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
366
363
chalk_solve:: rust_ir:: WellKnownTrait :: CopyTrait
367
364
| chalk_solve:: rust_ir:: WellKnownTrait :: CloneTrait => match ty {
368
365
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 ) }
377
371
}
378
- }
372
+ } ,
379
373
_ => None ,
380
374
} ,
381
375
Dyn ( _)
0 commit comments