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-02 10:55:44 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-07-12 00:38:40 -0400
commitdab206f8b57bba507436e23e0e80a6d1ed80bfc4 (patch)
tree91c0b99a494f1fec67fa3e7d3b977f5ff869265f /src/librustc_data_structures
parent90c90ba542635c3f2d1da71cb42569b6e7eeb6a9 (diff)
downloadrust-dab206f8b57bba507436e23e0e80a6d1ed80bfc4.tar.gz
rust-dab206f8b57bba507436e23e0e80a6d1ed80bfc4.zip
strengthen `Idx` to require `Ord + Hash`
You should always be able to know that any `T` where `T: Idx`
can be used in a `BTreeMap` and a `FxHashMap`.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/indexed_vec.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index ad3710e9536..26de2191090 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -14,6 +14,7 @@ use std::slice;
 use std::marker::PhantomData;
 use std::ops::{Index, IndexMut, Range, RangeBounds};
 use std::fmt;
+use std::hash::Hash;
 use std::vec;
 use std::u32;
 
@@ -22,7 +23,7 @@ use rustc_serialize as serialize;
 /// Represents some newtyped `usize` wrapper.
 ///
 /// (purpose: avoid mixing indexes for different bitvector domains.)
-pub trait Idx: Copy + 'static + Eq + Debug {
+pub trait Idx: Copy + 'static + Ord + Debug + Hash {
     fn new(idx: usize) -> Self;
     fn index(self) -> usize;
 }