@@ -109,13 +109,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
109
109
if self . cx . crate_name != Some ( "core" . to_string ( ) ) {
110
110
if let ty:: TyAdt ( _adt, _) = ty. sty {
111
111
let param_env = self . cx . tcx . param_env ( def_id) ;
112
- /*let print = match _adt.adt_kind() {
113
- AdtKind::Struct => {
114
- //println!("|||||> {}", self.cx.tcx.item_name(def_id).to_string());
115
- true
116
- }
117
- _ => false,
118
- };*/
119
112
for & trait_def_id in self . cx . all_traits . iter ( ) {
120
113
if traits. get ( & trait_def_id) . is_some ( ) ||
121
114
!self . cx . access_levels . borrow ( ) . is_doc_reachable ( trait_def_id) {
@@ -125,22 +118,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
125
118
self . cx . tcx . for_each_relevant_impl ( trait_def_id, ty, |impl_def_id| {
126
119
self . cx . tcx . infer_ctxt ( ) . enter ( |infcx| {
127
120
let generics = infcx. tcx . generics_of ( impl_def_id) ;
128
-
129
- /*if generics.count() == 0 {
130
- return;
131
- }*/
132
121
let trait_ref = infcx. tcx . impl_trait_ref ( impl_def_id) . unwrap ( ) ;
133
- /*if !trait_ref.substs.iter().any(|x| match x.unpack() {
134
- ::rustc::ty::subst::UnpackedKind::Type(ref t) => {
135
- match t.sty {
136
- ::rustc::ty::TypeVariants::TyParam(_) => true,
137
- _ => false,
138
- }
139
- }
140
- _ => false,
141
- }) {
142
- return;
143
- }*/
144
122
145
123
if !match infcx. tcx . type_of ( impl_def_id) . sty {
146
124
:: rustc:: ty:: TypeVariants :: TyParam ( _) => true ,
@@ -169,22 +147,8 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
169
147
param_env,
170
148
trait_ref. to_predicate ( ) ,
171
149
) ) ;
172
- /*if print {
173
- println!("==> {}", infcx.tcx.item_name(trait_def_id).to_string());
174
- }*/
175
150
if may_apply {
176
- // FIXME: add crate's id before the name to avoid removing a
177
- // trait which doesn't exist.
178
151
if traits. get ( & trait_def_id) . is_none ( ) {
179
- if self . cx . crate_name == Some ( "std" . to_string ( ) ) {
180
- println ! ( "visibility: ({} {}) [{} {:?}] [{} {:?}]" ,
181
- self . cx. tcx. item_name( def_id) . to_string( ) , t_name,
182
- impl_def_id. krate, impl_def_id. index,
183
- trait_def_id. krate, trait_def_id. index) ;
184
- println ! ( "{:?}" , infcx. tcx. visibility( impl_def_id) ) ;
185
- println ! ( "{:?}" , infcx. tcx. visibility( trait_def_id) ) ;
186
- }
187
-
188
152
let trait_ = hir:: TraitRef {
189
153
path : get_path_for_type ( infcx. tcx , trait_def_id, hir:: def:: Def :: Trait ) ,
190
154
ref_id : ast:: DUMMY_NODE_ID ,
@@ -213,27 +177,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
213
177
synthetic : true ,
214
178
} ) ,
215
179
} ) ;
216
-
217
- /*use ::clean::{self, inline::*};
218
-
219
- let mut ret = Vec::with_capacity(2);
220
- record_extern_fqn(self.cx, trait_def_id, clean::TypeKind::Trait);
221
- ret.extend(build_impls(self.cx, trait_def_id, false));
222
- let inner = clean::TraitItem(build_external_trait(self.cx, trait_def_id));
223
- let cx = self.cx;
224
- ret.push(clean::Item {
225
- source: infcx.tcx.def_span(trait_def_id).clean(cx),
226
- name: Some(infcx.tcx.item_name(trait_def_id).to_string()),
227
- attrs: load_attrs(cx, trait_def_id),
228
- inner,
229
- visibility: Some(clean::Public),
230
- stability: cx.tcx.lookup_stability(trait_def_id).clean(cx),
231
- deprecation: cx.tcx.lookup_deprecation(trait_def_id).clean(cx),
232
- def_id: trait_def_id,
233
- });
234
- traits.insert(trait_def_id, ret);*/
235
180
}
236
- //println!("=> {}", infcx.tcx.item_name(trait_def_id).to_string());
237
181
}
238
182
debug ! ( "{:?} => {}" , trait_ref, may_apply) ;
239
183
}
@@ -242,8 +186,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
242
186
}
243
187
}
244
188
}
245
- //let res = self.cx.tcx.trait_impls_of(def_id);
246
- //println!("=> {:?} {:?}", res.blanket_impls.len(), res.non_blanket_impls.len());
247
189
248
190
debug ! (
249
191
"get_auto_trait_impls(def_id={:?}, def_ctor=..., generics={:?}" ,
@@ -267,7 +209,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
267
209
def_ctor,
268
210
tcx. require_lang_item ( lang_items:: SyncTraitLangItem ) ,
269
211
) . into_iter ( ) )
270
- . chain ( traits. into_iter ( ) . map ( |( _, v) | v) ) //.flat_map(|(_, v)| v.into_iter()))
212
+ . chain ( traits. into_iter ( ) . map ( |( _, v) | v) )
271
213
. collect ( ) ;
272
214
273
215
debug ! (
0 commit comments