diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-02-11 05:59:01 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-02-12 13:02:37 -0500 |
| commit | acd1a0090a55bcb6810b2d6eb1676cb9a5fb65b7 (patch) | |
| tree | b97ed63d1ed3d22a3db682e541a348e83f03ec21 /src/libsyntax | |
| parent | cca1cf613b8e535ab274d6ce5aecadf4708990bf (diff) | |
| download | rust-acd1a0090a55bcb6810b2d6eb1676cb9a5fb65b7.tar.gz rust-acd1a0090a55bcb6810b2d6eb1676cb9a5fb65b7.zip | |
Update metadata to reflect that predicates/schemes/trait-defs are now severed
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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; |
