Skip to content

Commit 60f1944

Browse files
committed
rustc: rename DefPathData::{MacroDef,LifetimeParam} to {Macro,Lifetime}Ns.
1 parent 2efeb48 commit 60f1944

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

src/librustc/hir/lowering.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ impl<'a> LoweringContext<'a> {
952952
self.resolver.definitions().create_def_with_parent(
953953
parent_index,
954954
node_id,
955-
DefPathData::LifetimeParam(str_name),
955+
DefPathData::LifetimeNs(str_name),
956956
DefIndexAddressSpace::High,
957957
Mark::root(),
958958
span,
@@ -1749,7 +1749,7 @@ impl<'a> LoweringContext<'a> {
17491749
self.context.resolver.definitions().create_def_with_parent(
17501750
self.parent,
17511751
def_node_id,
1752-
DefPathData::LifetimeParam(name.ident().as_interned_str()),
1752+
DefPathData::LifetimeNs(name.ident().as_interned_str()),
17531753
DefIndexAddressSpace::High,
17541754
Mark::root(),
17551755
lifetime.span,

src/librustc/hir/map/def_collector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
164164
}
165165
ItemKind::Static(..) | ItemKind::Const(..) | ItemKind::Fn(..) =>
166166
DefPathData::ValueNs(i.ident.as_interned_str()),
167-
ItemKind::MacroDef(..) => DefPathData::MacroDef(i.ident.as_interned_str()),
167+
ItemKind::MacroDef(..) => DefPathData::MacroNs(i.ident.as_interned_str()),
168168
ItemKind::Mac(..) => return self.visit_macro_invoc(i.id),
169169
ItemKind::GlobalAsm(..) => DefPathData::Misc,
170170
ItemKind::Use(..) => {
@@ -236,7 +236,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
236236
fn visit_generic_param(&mut self, param: &'a GenericParam) {
237237
let name = param.ident.as_interned_str();
238238
let def_path_data = match param.kind {
239-
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeParam(name),
239+
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeNs(name),
240240
GenericParamKind::Type { .. } => DefPathData::TypeNs(name),
241241
GenericParamKind::Const { .. } => DefPathData::ValueNs(name),
242242
};

src/librustc/hir/map/definitions.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ pub enum DefPathData {
341341
TypeNs(InternedString),
342342
/// Something in the value NS
343343
ValueNs(InternedString),
344-
/// A macro rule
345-
MacroDef(InternedString),
344+
/// Something in the macro NS
345+
MacroNs(InternedString),
346+
/// Something in the lifetime NS
347+
LifetimeNs(InternedString),
346348
/// A closure expression
347349
ClosureExpr,
348350
// Subportions of items
349-
/// A lifetime (generic) parameter
350-
LifetimeParam(InternedString),
351351
/// Implicit ctor for a unit or tuple-like struct or enum variant.
352352
Ctor,
353353
/// A constant expression (see {ast,hir}::AnonConst).
@@ -614,8 +614,8 @@ impl DefPathData {
614614
match *self {
615615
TypeNs(name) |
616616
ValueNs(name) |
617-
MacroDef(name) |
618-
LifetimeParam(name) |
617+
MacroNs(name) |
618+
LifetimeNs(name) |
619619
GlobalMetaData(name) => Some(name),
620620

621621
Impl |
@@ -633,8 +633,8 @@ impl DefPathData {
633633
let s = match *self {
634634
TypeNs(name) |
635635
ValueNs(name) |
636-
MacroDef(name) |
637-
LifetimeParam(name) |
636+
MacroNs(name) |
637+
LifetimeNs(name) |
638638
GlobalMetaData(name) => {
639639
return name
640640
}

src/librustc/ty/print/pretty.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,16 @@ impl TyCtxt<'_, '_, '_> {
858858
// (but also some things just print a `DefId` generally so maybe we need this?)
859859
fn guess_def_namespace(self, def_id: DefId) -> Namespace {
860860
match self.def_key(def_id).disambiguated_data.data {
861-
DefPathData::ValueNs(..) |
862-
DefPathData::AnonConst |
863-
DefPathData::ClosureExpr |
864-
DefPathData::Ctor => Namespace::ValueNS,
861+
DefPathData::TypeNs(..)
862+
| DefPathData::CrateRoot
863+
| DefPathData::ImplTrait => Namespace::TypeNS,
865864

866-
DefPathData::MacroDef(..) => Namespace::MacroNS,
865+
DefPathData::ValueNs(..)
866+
| DefPathData::AnonConst
867+
| DefPathData::ClosureExpr
868+
| DefPathData::Ctor => Namespace::ValueNS,
869+
870+
DefPathData::MacroNs(..) => Namespace::MacroNS,
867871

868872
_ => Namespace::TypeNS,
869873
}

src/librustc_metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ crate fn proc_macro_def_path_table(crate_root: &CrateRoot,
459459
let def_index = definitions.create_def_with_parent(
460460
crate_root,
461461
ast::DUMMY_NODE_ID,
462-
DefPathData::MacroDef(name.as_interned_str()),
462+
DefPathData::MacroNs(name.as_interned_str()),
463463
DefIndexAddressSpace::High,
464464
Mark::root(),
465465
DUMMY_SP);

0 commit comments

Comments
 (0)