|
3 | 3 |
|
4 | 4 | use crate::check::FnCtxt; |
5 | 5 | use crate::middle::lang_items::FnOnceTraitLangItem; |
6 | | -use crate::namespace::Namespace; |
7 | 6 | use rustc::hir::map as hir_map; |
8 | 7 | use rustc::hir::map::Map; |
9 | 8 | use rustc::ty::print::with_crate_prefix; |
10 | 9 | use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; |
11 | 10 | use rustc_data_structures::fx::FxHashSet; |
12 | 11 | use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder}; |
13 | 12 | use rustc_hir as hir; |
14 | | -use rustc_hir::def::{DefKind, Res}; |
| 13 | +use rustc_hir::def::{DefKind, Namespace, Res}; |
15 | 14 | use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; |
16 | 15 | use rustc_hir::intravisit; |
17 | 16 | use rustc_hir::{ExprKind, Node, QPath}; |
@@ -97,13 +96,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
97 | 96 | // Provide the best span we can. Use the item, if local to crate, else |
98 | 97 | // the impl, if local to crate (item may be defaulted), else nothing. |
99 | 98 | let item = match self |
100 | | - .associated_item(impl_did, item_name, Namespace::Value) |
| 99 | + .associated_item(impl_did, item_name, Namespace::ValueNS) |
101 | 100 | .or_else(|| { |
102 | 101 | let impl_trait_ref = self.tcx.impl_trait_ref(impl_did)?; |
103 | 102 | self.associated_item( |
104 | 103 | impl_trait_ref.def_id, |
105 | 104 | item_name, |
106 | | - Namespace::Value, |
| 105 | + Namespace::ValueNS, |
107 | 106 | ) |
108 | 107 | }) { |
109 | 108 | Some(item) => item, |
@@ -185,7 +184,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
185 | 184 | } |
186 | 185 | CandidateSource::TraitSource(trait_did) => { |
187 | 186 | let item = |
188 | | - match self.associated_item(trait_did, item_name, Namespace::Value) { |
| 187 | + match self.associated_item(trait_did, item_name, Namespace::ValueNS) { |
189 | 188 | Some(item) => item, |
190 | 189 | None => continue, |
191 | 190 | }; |
@@ -264,7 +263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
264 | 263 | // be used exists at all, and the type is an ambiguous numeric type |
265 | 264 | // ({integer}/{float}). |
266 | 265 | let mut candidates = all_traits(self.tcx).into_iter().filter_map(|info| { |
267 | | - self.associated_item(info.def_id, item_name, Namespace::Value) |
| 266 | + self.associated_item(info.def_id, item_name, Namespace::ValueNS) |
268 | 267 | }); |
269 | 268 | if let (true, false, SelfSource::MethodCall(expr), Some(_)) = ( |
270 | 269 | actual.is_numeric(), |
@@ -779,7 +778,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
779 | 778 | // here). |
780 | 779 | (type_is_local || info.def_id.is_local()) |
781 | 780 | && self |
782 | | - .associated_item(info.def_id, item_name, Namespace::Value) |
| 781 | + .associated_item(info.def_id, item_name, Namespace::ValueNS) |
783 | 782 | .filter(|item| { |
784 | 783 | // We only want to suggest public or local traits (#45781). |
785 | 784 | item.vis == ty::Visibility::Public || info.def_id.is_local() |
|
0 commit comments