@@ -7,10 +7,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
7
7
use rustc_macros:: { Decodable_NoContext , Encodable_NoContext , HashStable_NoContext } ;
8
8
use rustc_type_ir_macros:: { Lift_Generic , TypeFoldable_Generic , TypeVisitable_Generic } ;
9
9
10
- use crate :: {
11
- self as ty, DebruijnIndex , FallibleTypeFolder , Interner , TypeFoldable , TypeFolder ,
12
- TypeVisitable , TypeVisitor , VisitorResult ,
13
- } ;
10
+ use crate :: { self as ty, DebruijnIndex , Interner } ;
14
11
15
12
/// Represents a constant in Rust.
16
13
#[ derive_where( Clone , Copy , Hash , PartialEq , Eq ; I : Interner ) ]
@@ -95,10 +92,15 @@ rustc_index::newtype_index! {
95
92
96
93
/// An inference variable for a const, for use in const generics.
97
94
#[ derive( Copy , Clone , Eq , PartialEq , PartialOrd , Ord , Hash ) ]
95
+ #[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
98
96
#[ cfg_attr( feature = "nightly" , derive( Encodable_NoContext , Decodable_NoContext ) ) ]
99
97
pub enum InferConst {
100
98
/// Infer the value of the const.
101
- Var ( ConstVid ) ,
99
+ Var (
100
+ #[ type_foldable( identity) ]
101
+ #[ type_visitable( ignore) ]
102
+ ConstVid ,
103
+ ) ,
102
104
/// A fresh const variable. See `infer::freshen` for more details.
103
105
Fresh ( u32 ) ,
104
106
}
@@ -123,19 +125,3 @@ impl<CTX> HashStable<CTX> for InferConst {
123
125
}
124
126
}
125
127
}
126
-
127
- impl < I : Interner > TypeFoldable < I > for InferConst {
128
- fn try_fold_with < F : FallibleTypeFolder < I > > ( self , _folder : & mut F ) -> Result < Self , F :: Error > {
129
- Ok ( self )
130
- }
131
-
132
- fn fold_with < F : TypeFolder < I > > ( self , _folder : & mut F ) -> Self {
133
- self
134
- }
135
- }
136
-
137
- impl < I : Interner > TypeVisitable < I > for InferConst {
138
- fn visit_with < V : TypeVisitor < I > > ( & self , _visitor : & mut V ) -> V :: Result {
139
- V :: Result :: output ( )
140
- }
141
- }
0 commit comments