@@ -25,50 +25,9 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
25
25
26
26
use std:: fmt;
27
27
28
- #[ cfg( feature = "rustc" ) ]
29
- pub mod index {
30
- // Faster version when the indices of variants are `0..variants.len()`.
31
- pub use rustc_index:: bit_set:: BitSet as IdxSet ;
32
- pub use rustc_index:: Idx ;
33
- pub use rustc_index:: IndexVec as IdxContainer ;
34
- }
35
- #[ cfg( not( feature = "rustc" ) ) ]
36
- pub mod index {
37
- // Slower version when the indices of variants are something else.
38
- pub trait Idx : Copy + PartialEq + Eq + std:: hash:: Hash { }
39
- impl < T : Copy + PartialEq + Eq + std:: hash:: Hash > Idx for T { }
40
-
41
- #[ derive( Debug ) ]
42
- pub struct IdxContainer < K , V > ( pub rustc_hash:: FxHashMap < K , V > ) ;
43
- impl < K : Idx , V > IdxContainer < K , V > {
44
- pub fn len ( & self ) -> usize {
45
- self . 0 . len ( )
46
- }
47
- pub fn iter_enumerated ( & self ) -> impl Iterator < Item = ( K , & V ) > {
48
- self . 0 . iter ( ) . map ( |( k, v) | ( * k, v) )
49
- }
50
- }
51
-
52
- impl < V > FromIterator < V > for IdxContainer < usize , V > {
53
- fn from_iter < T : IntoIterator < Item = V > > ( iter : T ) -> Self {
54
- Self ( iter. into_iter ( ) . enumerate ( ) . collect ( ) )
55
- }
56
- }
57
-
58
- #[ derive( Debug ) ]
59
- pub struct IdxSet < T > ( pub rustc_hash:: FxHashSet < T > ) ;
60
- impl < T : Idx > IdxSet < T > {
61
- pub fn new_empty ( _len : usize ) -> Self {
62
- Self ( Default :: default ( ) )
63
- }
64
- pub fn contains ( & self , elem : T ) -> bool {
65
- self . 0 . contains ( & elem)
66
- }
67
- pub fn insert ( & mut self , elem : T ) {
68
- self . 0 . insert ( elem) ;
69
- }
70
- }
71
- }
28
+ // Re-exports to avoid rustc_index version issues.
29
+ pub use rustc_index:: Idx ;
30
+ pub use rustc_index:: IndexVec ;
72
31
73
32
#[ cfg( feature = "rustc" ) ]
74
33
use rustc_middle:: ty:: Ty ;
@@ -96,7 +55,7 @@ pub trait PatCx: Sized + fmt::Debug {
96
55
/// Errors that can abort analysis.
97
56
type Error : fmt:: Debug ;
98
57
/// The index of an enum variant.
99
- type VariantIdx : Clone + index :: Idx + fmt:: Debug ;
58
+ type VariantIdx : Clone + Idx + fmt:: Debug ;
100
59
/// A string literal
101
60
type StrLit : Clone + PartialEq + fmt:: Debug ;
102
61
/// Extra data to store in a match arm.
0 commit comments