rustc: collapse relevant DefPathData variants into ValueNs.
This commit is contained in:
parent
e5b9f54cd9
commit
2efeb485a9
3 changed files with 2 additions and 12 deletions
|
@ -226,7 +226,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||||
let name = field.ident.map(|ident| ident.name)
|
let name = field.ident.map(|ident| ident.name)
|
||||||
.unwrap_or_else(|| Symbol::intern(&index.to_string()));
|
.unwrap_or_else(|| Symbol::intern(&index.to_string()));
|
||||||
let def = self.create_def(field.id,
|
let def = self.create_def(field.id,
|
||||||
DefPathData::Field(name.as_interned_str()),
|
DefPathData::ValueNs(name.as_interned_str()),
|
||||||
REGULAR_SPACE,
|
REGULAR_SPACE,
|
||||||
field.span);
|
field.span);
|
||||||
self.with_parent(def, |this| this.visit_struct_field(field));
|
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 {
|
let def_path_data = match param.kind {
|
||||||
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeParam(name),
|
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeParam(name),
|
||||||
GenericParamKind::Type { .. } => DefPathData::TypeNs(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);
|
self.create_def(param.id, def_path_data, REGULAR_SPACE, param.ident.span);
|
||||||
|
|
||||||
|
|
|
@ -348,10 +348,6 @@ pub enum DefPathData {
|
||||||
// Subportions of items
|
// Subportions of items
|
||||||
/// A lifetime (generic) parameter
|
/// A lifetime (generic) parameter
|
||||||
LifetimeParam(InternedString),
|
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.
|
/// Implicit ctor for a unit or tuple-like struct or enum variant.
|
||||||
Ctor,
|
Ctor,
|
||||||
/// A constant expression (see {ast,hir}::AnonConst).
|
/// A constant expression (see {ast,hir}::AnonConst).
|
||||||
|
@ -620,8 +616,6 @@ impl DefPathData {
|
||||||
ValueNs(name) |
|
ValueNs(name) |
|
||||||
MacroDef(name) |
|
MacroDef(name) |
|
||||||
LifetimeParam(name) |
|
LifetimeParam(name) |
|
||||||
ConstParam(name) |
|
|
||||||
Field(name) |
|
|
||||||
GlobalMetaData(name) => Some(name),
|
GlobalMetaData(name) => Some(name),
|
||||||
|
|
||||||
Impl |
|
Impl |
|
||||||
|
@ -641,8 +635,6 @@ impl DefPathData {
|
||||||
ValueNs(name) |
|
ValueNs(name) |
|
||||||
MacroDef(name) |
|
MacroDef(name) |
|
||||||
LifetimeParam(name) |
|
LifetimeParam(name) |
|
||||||
ConstParam(name) |
|
|
||||||
Field(name) |
|
|
||||||
GlobalMetaData(name) => {
|
GlobalMetaData(name) => {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
|
@ -859,9 +859,7 @@ impl TyCtxt<'_, '_, '_> {
|
||||||
fn guess_def_namespace(self, def_id: DefId) -> Namespace {
|
fn guess_def_namespace(self, def_id: DefId) -> Namespace {
|
||||||
match self.def_key(def_id).disambiguated_data.data {
|
match self.def_key(def_id).disambiguated_data.data {
|
||||||
DefPathData::ValueNs(..) |
|
DefPathData::ValueNs(..) |
|
||||||
DefPathData::Field(..) |
|
|
||||||
DefPathData::AnonConst |
|
DefPathData::AnonConst |
|
||||||
DefPathData::ConstParam(..) |
|
|
||||||
DefPathData::ClosureExpr |
|
DefPathData::ClosureExpr |
|
||||||
DefPathData::Ctor => Namespace::ValueNS,
|
DefPathData::Ctor => Namespace::ValueNS,
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue