@@ -109,13 +109,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
109109 if self . cx . crate_name != Some ( "core" . to_string ( ) ) {
110110 if let ty:: TyAdt ( _adt, _) = ty. sty {
111111 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- };*/
119112 for & trait_def_id in self . cx . all_traits . iter ( ) {
120113 if traits. get ( & trait_def_id) . is_some ( ) ||
121114 !self . cx . access_levels . borrow ( ) . is_doc_reachable ( trait_def_id) {
@@ -125,22 +118,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
125118 self . cx . tcx . for_each_relevant_impl ( trait_def_id, ty, |impl_def_id| {
126119 self . cx . tcx . infer_ctxt ( ) . enter ( |infcx| {
127120 let generics = infcx. tcx . generics_of ( impl_def_id) ;
128-
129- /*if generics.count() == 0 {
130- return;
131- }*/
132121 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- }*/
144122
145123 if !match infcx. tcx . type_of ( impl_def_id) . sty {
146124 :: rustc:: ty:: TypeVariants :: TyParam ( _) => true ,
@@ -169,22 +147,8 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
169147 param_env,
170148 trait_ref. to_predicate ( ) ,
171149 ) ) ;
172- /*if print {
173- println!("==> {}", infcx.tcx.item_name(trait_def_id).to_string());
174- }*/
175150 if may_apply {
176- // FIXME: add crate's id before the name to avoid removing a
177- // trait which doesn't exist.
178151 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-
188152 let trait_ = hir:: TraitRef {
189153 path : get_path_for_type ( infcx. tcx , trait_def_id, hir:: def:: Def :: Trait ) ,
190154 ref_id : ast:: DUMMY_NODE_ID ,
@@ -213,27 +177,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
213177 synthetic : true ,
214178 } ) ,
215179 } ) ;
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);*/
235180 }
236- //println!("=> {}", infcx.tcx.item_name(trait_def_id).to_string());
237181 }
238182 debug ! ( "{:?} => {}" , trait_ref, may_apply) ;
239183 }
@@ -242,8 +186,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
242186 }
243187 }
244188 }
245- //let res = self.cx.tcx.trait_impls_of(def_id);
246- //println!("=> {:?} {:?}", res.blanket_impls.len(), res.non_blanket_impls.len());
247189
248190 debug ! (
249191 "get_auto_trait_impls(def_id={:?}, def_ctor=..., generics={:?}" ,
@@ -267,7 +209,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
267209 def_ctor,
268210 tcx. require_lang_item ( lang_items:: SyncTraitLangItem ) ,
269211 ) . into_iter ( ) )
270- . chain ( traits. into_iter ( ) . map ( |( _, v) | v) ) //.flat_map(|(_, v)| v.into_iter()))
212+ . chain ( traits. into_iter ( ) . map ( |( _, v) | v) )
271213 . collect ( ) ;
272214
273215 debug ! (
0 commit comments