@@ -17,6 +17,7 @@ use rustc::ty::{self, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable};
17
17
use hir:: def:: Def ;
18
18
use hir:: def_id:: { CRATE_DEF_INDEX , DefId } ;
19
19
use middle:: lang_items:: FnOnceTraitLangItem ;
20
+ use namespace:: Namespace ;
20
21
use rustc:: traits:: { Obligation , SelectionContext } ;
21
22
use util:: nodemap:: FxHashSet ;
22
23
@@ -92,12 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
92
93
CandidateSource :: ImplSource ( impl_did) => {
93
94
// Provide the best span we can. Use the item, if local to crate, else
94
95
// 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 )
96
97
. or_else ( || {
97
98
self . associated_item (
98
99
self . tcx . impl_trait_ref ( impl_did) . unwrap ( ) . def_id ,
99
-
100
- item_name
100
+ item_name ,
101
+ Namespace :: Value ,
101
102
)
102
103
} ) . unwrap ( ) ;
103
104
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> {
127
128
}
128
129
}
129
130
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 ( ) ;
131
134
let item_span = self . tcx . def_span ( item. def_id ) ;
132
135
span_note ! ( err,
133
136
item_span,
@@ -402,7 +405,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
402
405
// implementing a trait would be legal but is rejected
403
406
// here).
404
407
( 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 ( )
406
409
} )
407
410
. collect :: < Vec < _ > > ( ) ;
408
411
0 commit comments