@@ -152,7 +152,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
152
152
}
153
153
self . cx . tcx . for_each_relevant_impl ( trait_def_id, ty, |impl_def_id| {
154
154
self . cx . tcx . infer_ctxt ( ) . enter ( |infcx| {
155
- let generics = infcx. tcx . generics_of ( impl_def_id) ;
155
+ let t_generics = infcx. tcx . generics_of ( impl_def_id) ;
156
156
let trait_ref = infcx. tcx . impl_trait_ref ( impl_def_id) . unwrap ( ) ;
157
157
158
158
match infcx. tcx . type_of ( impl_def_id) . sty {
@@ -161,7 +161,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
161
161
}
162
162
163
163
let substs = infcx. fresh_substs_for_item ( DUMMY_SP , def_id) ;
164
- let ty2 = ty. subst ( infcx. tcx , substs) ;
164
+ let ty = ty. subst ( infcx. tcx , substs) ;
165
165
let param_env = param_env. subst ( infcx. tcx , substs) ;
166
166
167
167
let impl_substs = infcx. fresh_substs_for_item ( DUMMY_SP , impl_def_id) ;
@@ -171,7 +171,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
171
171
// our type, and ignore the impl if there was a mismatch.
172
172
let cause = traits:: ObligationCause :: dummy ( ) ;
173
173
let eq_result = infcx. at ( & cause, param_env)
174
- . eq ( trait_ref. self_ty ( ) , ty2 ) ;
174
+ . eq ( trait_ref. self_ty ( ) , ty ) ;
175
175
if let Ok ( InferOk { value : ( ) , obligations } ) = eq_result {
176
176
// FIXME(eddyb) ignoring `obligations` might cause false positives.
177
177
drop ( obligations) ;
@@ -199,9 +199,10 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
199
199
. collect ( ) ;
200
200
201
201
let ty = self . get_real_ty ( def_id, def_ctor, & real_name, generics) ;
202
+ let predicates = infcx. tcx . predicates_of ( def_id) ;
202
203
203
204
traits. push ( Item {
204
- source : Span :: empty ( ) ,
205
+ source : infcx . tcx . def_span ( impl_def_id ) . clean ( self . cx ) ,
205
206
name : None ,
206
207
attrs : Default :: default ( ) ,
207
208
visibility : None ,
@@ -210,8 +211,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
210
211
deprecation : None ,
211
212
inner : ImplItem ( Impl {
212
213
unsafety : hir:: Unsafety :: Normal ,
213
- generics : ( generics,
214
- & tcx. predicates_of ( impl_def_id) ) . clean ( self . cx ) ,
214
+ generics : ( t_generics, & predicates) . clean ( self . cx ) ,
215
215
provided_trait_methods,
216
216
trait_ : Some ( trait_. clean ( self . cx ) ) ,
217
217
for_ : ty. clean ( self . cx ) ,
0 commit comments