about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-07-25 13:43:35 +0300
committerNiko Matsakis <niko@alum.mit.edu>2018-09-07 11:34:41 -0400
commitc46f185f670ff051f56f48d7f19da4b116a6128a (patch)
treee1dfba836789be8b3b71e73b5d16c7a60e38b0b6 /src/librustc_data_structures
parent1242639b88b0dee9ebb0f103efe017826c5b334e (diff)
downloadrust-c46f185f670ff051f56f48d7f19da4b116a6128a.tar.gz
rust-c46f185f670ff051f56f48d7f19da4b116a6128a.zip
add a comment
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/indexed_vec.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index f8992c991cc..09015957f99 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -48,6 +48,13 @@ impl Idx for u32 {
     fn index(self) -> usize { self as usize }
 }
 
+/// Creates a struct type `S` that can be used as an index with
+/// `IndexVec` and so on.  This struct can be constructed via `S::new`
+/// (given a `usize`) and converted to a usize with the `index()`
+/// method (from the `Idx` trait). Internally, the index uses a u32,
+/// so the index must not exceed `u32::MAX`. You can also customize
+/// things like the `Debug` impl, what traits are derived, and so
+/// forth.
 #[macro_export]
 macro_rules! newtype_index {
     // ---- public rules ----