Skip to content

Commit 6eb0b05

Browse files
Add src and fix generics display issues
1 parent 459550b commit 6eb0b05

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustdoc/clean/auto_trait.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
152152
}
153153
self.cx.tcx.for_each_relevant_impl(trait_def_id, ty, |impl_def_id| {
154154
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);
156156
let trait_ref = infcx.tcx.impl_trait_ref(impl_def_id).unwrap();
157157

158158
match infcx.tcx.type_of(impl_def_id).sty {
@@ -161,7 +161,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
161161
}
162162

163163
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);
165165
let param_env = param_env.subst(infcx.tcx, substs);
166166

167167
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> {
171171
// our type, and ignore the impl if there was a mismatch.
172172
let cause = traits::ObligationCause::dummy();
173173
let eq_result = infcx.at(&cause, param_env)
174-
.eq(trait_ref.self_ty(), ty2);
174+
.eq(trait_ref.self_ty(), ty);
175175
if let Ok(InferOk { value: (), obligations }) = eq_result {
176176
// FIXME(eddyb) ignoring `obligations` might cause false positives.
177177
drop(obligations);
@@ -199,9 +199,10 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
199199
.collect();
200200

201201
let ty = self.get_real_ty(def_id, def_ctor, &real_name, generics);
202+
let predicates = infcx.tcx.predicates_of(def_id);
202203

203204
traits.push(Item {
204-
source: Span::empty(),
205+
source: infcx.tcx.def_span(impl_def_id).clean(self.cx),
205206
name: None,
206207
attrs: Default::default(),
207208
visibility: None,
@@ -210,8 +211,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
210211
deprecation: None,
211212
inner: ImplItem(Impl {
212213
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),
215215
provided_trait_methods,
216216
trait_: Some(trait_.clean(self.cx)),
217217
for_: ty.clean(self.cx),

0 commit comments

Comments
 (0)