From bff28ec46866bb2980d67a644e4e567b67ccb706 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Tue, 28 Jun 2016 23:41:09 +0300 Subject: refactor rustc_metadata to use CamelCase names and IndexVec --- src/librustc_data_structures/indexed_vec.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/librustc_data_structures') diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index b3918f1e4bc..91234631499 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -15,6 +15,7 @@ use std::marker::PhantomData; use std::ops::{Index, IndexMut, Range}; use std::fmt; use std::vec; +use std::u32; use rustc_serialize as serialize; @@ -31,6 +32,11 @@ impl Idx for usize { fn index(self) -> usize { self } } +impl Idx for u32 { + fn new(idx: usize) -> Self { assert!(idx <= u32::MAX as usize); idx as u32 } + fn index(self) -> usize { self as usize } +} + #[derive(Clone)] pub struct IndexVec { pub raw: Vec, -- cgit 1.4.1-3-g733a5