From acd1a0090a55bcb6810b2d6eb1676cb9a5fb65b7 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 11 Feb 2015 05:59:01 -0500 Subject: Update metadata to reflect that predicates/schemes/trait-defs are now severed --- src/libsyntax/ast.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 5979d339e17..d6778be553e 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -366,6 +366,14 @@ pub struct DefId { pub node: NodeId, } +impl DefId { + /// Read the node id, asserting that this def-id is krate-local. + pub fn local_id(&self) -> NodeId { + assert_eq!(self.krate, LOCAL_CRATE); + self.node + } +} + /// Item definitions in the currently-compiled crate would have the CrateNum /// LOCAL_CRATE in their DefId. pub const LOCAL_CRATE: CrateNum = 0; -- cgit 1.4.1-3-g733a5