// information we encapsulate into
let def_data = match i.node {
ItemKind::Impl(..) => DefPathData::Impl,
+ ItemKind::Trait(..) => DefPathData::Trait(i.ident.name.as_str()),
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) |
- ItemKind::Trait(..) | ItemKind::TraitAlias(..) |
+ ItemKind::TraitAlias(..) |
ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) | ItemKind::Ty(..) =>
DefPathData::TypeNs(i.ident.name.as_str()),
ItemKind::Mod(..) if i.ident == keywords::Invalid.ident() => {
let def_data = match ti.node {
TraitItemKind::Method(..) | TraitItemKind::Const(..) =>
DefPathData::ValueNs(ti.ident.name.as_str()),
- TraitItemKind::Type(..) => DefPathData::TypeNs(ti.ident.name.as_str()),
+ TraitItemKind::Type(..) => DefPathData::AssocTypeInTrait(ti.ident.name.as_str()),
TraitItemKind::Macro(..) => return self.visit_macro_invoc(ti.id, false),
};
let def_data = match ii.node {
ImplItemKind::Method(..) | ImplItemKind::Const(..) =>
DefPathData::ValueNs(ii.ident.name.as_str()),
- ImplItemKind::Type(..) => DefPathData::TypeNs(ii.ident.name.as_str()),
+ ImplItemKind::Type(..) => DefPathData::AssocTypeInImpl(ii.ident.name.as_str()),
ImplItemKind::Macro(..) => return self.visit_macro_invoc(ii.id, false),
};
::std::mem::discriminant(data).hash(&mut hasher);
match *data {
DefPathData::TypeNs(name) |
+ DefPathData::Trait(name) |
+ DefPathData::AssocTypeInTrait(name) |
+ DefPathData::AssocTypeInImpl(name) |
DefPathData::ValueNs(name) |
DefPathData::Module(name) |
DefPathData::MacroDef(name) |
// Different kinds of items and item-like things:
/// An impl
Impl,
+ /// A trait
+ Trait(InternedString),
+ /// An associated type **declaration** (i.e., in a trait)
+ AssocTypeInTrait(InternedString),
+ /// An associated type **value** (i.e., in an impl)
+ AssocTypeInImpl(InternedString),
/// Something in the type NS
TypeNs(InternedString),
/// Something in the value NS
use self::DefPathData::*;
match *self {
TypeNs(name) |
+ Trait(name) |
+ AssocTypeInTrait(name) |
+ AssocTypeInImpl(name) |
ValueNs(name) |
Module(name) |
MacroDef(name) |
use self::DefPathData::*;
let s = match *self {
TypeNs(name) |
+ Trait(name) |
+ AssocTypeInTrait(name) |
+ AssocTypeInImpl(name) |
ValueNs(name) |
Module(name) |
MacroDef(name) |
// finer-grained distinctions, e.g. between enum/struct).
data @ DefPathData::Misc |
data @ DefPathData::TypeNs(..) |
+ data @ DefPathData::Trait(..) |
+ data @ DefPathData::AssocTypeInTrait(..) |
+ data @ DefPathData::AssocTypeInImpl(..) |
data @ DefPathData::ValueNs(..) |
data @ DefPathData::Module(..) |
data @ DefPathData::TypeParam(..) |
loop {
let key = tcx.def_key(item_def_id);
match key.disambiguated_data.data {
+ DefPathData::AssocTypeInTrait(_) |
+ DefPathData::AssocTypeInImpl(_) |
+ DefPathData::Trait(_) |
DefPathData::TypeNs(_) => {
break;
}
- DefPathData::ValueNs(_) | DefPathData::EnumVariant(_) => {
+ DefPathData::ValueNs(_) |
+ DefPathData::EnumVariant(_) => {
is_value_path = true;
break;
}
- _ => {
+ DefPathData::CrateRoot |
+ DefPathData::Misc |
+ DefPathData::Impl |
+ DefPathData::Module(_) |
+ DefPathData::MacroDef(_) |
+ DefPathData::ClosureExpr |
+ DefPathData::TypeParam(_) |
+ DefPathData::LifetimeDef(_) |
+ DefPathData::Field(_) |
+ DefPathData::StructCtor |
+ DefPathData::Initializer |
+ DefPathData::ImplTrait |
+ DefPathData::Typeof |
+ DefPathData::GlobalMetaData(_) => {
// if we're making a symbol for something, there ought
// to be a value or type-def or something in there
// *somewhere*