diff options
| author | ardi <oriongonza@gmail.com> | 2024-01-10 11:17:46 +0100 |
|---|---|---|
| committer | ardi <oriongonza@gmail.com> | 2024-01-10 12:41:29 +0100 |
| commit | 1bf3aee3811b92d5833154fd35b98159a233b938 (patch) | |
| tree | 9e7421c29e1bdbadec122a512a98401d2aa55d70 | |
| parent | 281ceb2bd2b2dd5f6ac201f585a2de2d21a41250 (diff) | |
| download | rust-1bf3aee3811b92d5833154fd35b98159a233b938.tar.gz rust-1bf3aee3811b92d5833154fd35b98159a233b938.zip | |
Oh well
| -rw-r--r-- | compiler/rustc_index/src/vec.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 3148b054790..3c66e6dde1c 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -17,27 +17,15 @@ use crate::{Idx, IndexSlice}; /// While it's possible to use `u32` or `usize` directly for `I`, /// you almost certainly want to use a [`newtype_index!`]-generated type instead. /// -/// This allows to index the IndexVec with the new index type: +/// This allows to index the IndexVec with the new index type /// -/// ``` -/// use crate as rustc_index; -/// use rustc_index::{IndexVec, newtype_index}; -/// -/// newtype_index! { -/// pub struct MyIdx {} -/// } -/// -/// let my_index_vec: IndexVec<MyIdx, u32> = IndexVec::from_raw(vec![0,1,2,3]); -/// let idx: MyIdx = MyIdx::from_u32(2); -/// assert_eq!(my_index_vec[idx], 2); -/// ``` /// /// [`newtype_index!`]: ../macro.newtype_index.html #[derive(Clone, PartialEq, Eq, Hash)] #[repr(transparent)] pub struct IndexVec<I: Idx, T> { pub raw: Vec<T>, - _marker: PhantomData<fn(&I)>, + _marker: PhantomData<I>, } impl<I: Idx, T> IndexVec<I, T> { @@ -77,7 +65,7 @@ impl<I: Idx, T> IndexVec<I, T> { IndexVec::from_raw(vec![elem; universe.len()]) } - /// Creates a new `IndexVec` with n copies of `elem` + /// Creates a new IndexVec #[inline] pub fn from_elem_n(elem: T, n: usize) -> Self where |
