Skip to content
Permalink
Browse files

rustc: collapse relevant DefPathData variants into ValueNs.

  • Loading branch information...
eddyb committed May 3, 2019
1 parent e5b9f54 commit 2efeb485a99dc3a769f21f111310a6541b21d8b2
Showing with 2 additions and 12 deletions.
  1. +2 −2 src/librustc/hir/map/def_collector.rs
  2. +0 −8 src/librustc/hir/map/definitions.rs
  3. +0 −2 src/librustc/ty/print/pretty.rs
@@ -226,7 +226,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
let name = field.ident.map(|ident| ident.name)
.unwrap_or_else(|| Symbol::intern(&index.to_string()));
let def = self.create_def(field.id,
DefPathData::Field(name.as_interned_str()),
DefPathData::ValueNs(name.as_interned_str()),
REGULAR_SPACE,
field.span);
self.with_parent(def, |this| this.visit_struct_field(field));
@@ -238,7 +238,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
let def_path_data = match param.kind {
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeParam(name),
GenericParamKind::Type { .. } => DefPathData::TypeNs(name),
GenericParamKind::Const { .. } => DefPathData::ConstParam(name),
GenericParamKind::Const { .. } => DefPathData::ValueNs(name),
};
self.create_def(param.id, def_path_data, REGULAR_SPACE, param.ident.span);

@@ -348,10 +348,6 @@ pub enum DefPathData {
// Subportions of items
/// A lifetime (generic) parameter
LifetimeParam(InternedString),
/// A const (generic) parameter
ConstParam(InternedString),
/// A struct field
Field(InternedString),
/// Implicit ctor for a unit or tuple-like struct or enum variant.
Ctor,
/// A constant expression (see {ast,hir}::AnonConst).
@@ -620,8 +616,6 @@ impl DefPathData {
ValueNs(name) |
MacroDef(name) |
LifetimeParam(name) |
ConstParam(name) |
Field(name) |
GlobalMetaData(name) => Some(name),

Impl |
@@ -641,8 +635,6 @@ impl DefPathData {
ValueNs(name) |
MacroDef(name) |
LifetimeParam(name) |
ConstParam(name) |
Field(name) |
GlobalMetaData(name) => {
return name
}
@@ -859,9 +859,7 @@ impl TyCtxt<'_, '_, '_> {
fn guess_def_namespace(self, def_id: DefId) -> Namespace {
match self.def_key(def_id).disambiguated_data.data {
DefPathData::ValueNs(..) |
DefPathData::Field(..) |
DefPathData::AnonConst |
DefPathData::ConstParam(..) |
DefPathData::ClosureExpr |
DefPathData::Ctor => Namespace::ValueNS,

0 comments on commit 2efeb48

Please sign in to comment.
You can’t perform that action at this time.