// except according to those terms.
pub use self::Def::*;
-pub use self::MethodProvenance::*;
use middle::privacy::LastPrivate;
use middle::subst::ParamSpace;
DefForeignMod(ast::DefId),
DefStatic(ast::DefId, bool /* is_mutbl */),
DefConst(ast::DefId),
- DefAssociatedConst(ast::DefId /* const */, MethodProvenance),
+ DefAssociatedConst(ast::DefId),
DefLocal(ast::NodeId),
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
DefTy(ast::DefId, bool /* is_enum */),
DefStruct(ast::DefId),
DefRegion(ast::NodeId),
DefLabel(ast::NodeId),
- DefMethod(ast::DefId /* method */, MethodProvenance),
+ DefMethod(ast::DefId),
}
/// The result of resolving a path.
pub def_id: ast::DefId, // The definition of the target.
}
-#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub enum MethodProvenance {
- FromTrait(ast::DefId),
- FromImpl(ast::DefId),
-}
-
-impl MethodProvenance {
- pub fn map<F>(self, f: F) -> MethodProvenance where
- F: FnOnce(ast::DefId) -> ast::DefId,
- {
- match self {
- FromTrait(did) => FromTrait(f(did)),
- FromImpl(did) => FromImpl(f(did))
- }
- }
-}
-
impl Def {
pub fn local_node_id(&self) -> ast::NodeId {
let def_id = self.def_id();
DefFn(id, _) | DefMod(id) | DefForeignMod(id) | DefStatic(id, _) |
DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(_, id) |
DefTyParam(_, _, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) |
- DefMethod(id, _) | DefConst(id) | DefAssociatedConst(id, _) |
+ DefMethod(id) | DefConst(id) | DefAssociatedConst(id) |
DefSelfTy(Some(id), None)=> {
id
}