1
Fork 0

rustc: collapse relevant DefPathData variants into ValueNs.

This commit is contained in:
Eduard-Mihai Burtescu 2019-05-03 22:28:29 +03:00
parent e5b9f54cd9
commit 2efeb485a9
3 changed files with 2 additions and 12 deletions

View file

@ -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);

View file

@ -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
}

View file

@ -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,