@@ -17,6 +17,7 @@ use rustc::ty::{self, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable};
1717use hir:: def:: Def ;
1818use hir:: def_id:: { CRATE_DEF_INDEX , DefId } ;
1919use middle:: lang_items:: FnOnceTraitLangItem ;
20+ use namespace:: Namespace ;
2021use rustc:: traits:: { Obligation , SelectionContext } ;
2122use util:: nodemap:: FxHashSet ;
2223
@@ -92,12 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
9293 CandidateSource :: ImplSource ( impl_did) => {
9394 // Provide the best span we can. Use the item, if local to crate, else
9495 // the impl, if local to crate (item may be defaulted), else nothing.
95- let item = self . associated_item ( impl_did, item_name)
96+ let item = self . associated_item ( impl_did, item_name, Namespace :: Value )
9697 . or_else ( || {
9798 self . associated_item (
9899 self . tcx . impl_trait_ref ( impl_did) . unwrap ( ) . def_id ,
99-
100- item_name
100+ item_name ,
101+ Namespace :: Value ,
101102 )
102103 } ) . unwrap ( ) ;
103104 let note_span = self . tcx . hir . span_if_local ( item. def_id ) . or_else ( || {
@@ -127,7 +128,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
127128 }
128129 }
129130 CandidateSource :: TraitSource ( trait_did) => {
130- let item = self . associated_item ( trait_did, item_name) . unwrap ( ) ;
131+ let item = self
132+ . associated_item ( trait_did, item_name, Namespace :: Value )
133+ . unwrap ( ) ;
131134 let item_span = self . tcx . def_span ( item. def_id ) ;
132135 span_note ! ( err,
133136 item_span,
@@ -402,7 +405,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
402405 // implementing a trait would be legal but is rejected
403406 // here).
404407 ( type_is_local || info. def_id . is_local ( ) )
405- && self . associated_item ( info. def_id , item_name) . is_some ( )
408+ && self . associated_item ( info. def_id , item_name, Namespace :: Value ) . is_some ( )
406409 } )
407410 . collect :: < Vec < _ > > ( ) ;
408411
0 commit comments