@@ -77,10 +77,9 @@ impl BoundRegion {
77
77
}
78
78
}
79
79
80
- /// NB: If you change this, you'll probably want to change the corresponding
81
- /// AST structure in libsyntax/ast.rs as well.
82
- #[ derive( Clone , PartialEq , Eq , Hash , Debug , RustcEncodable , RustcDecodable ) ]
83
- pub enum TypeVariants < ' tcx > {
80
+ macro_rules! type_variants {
81
+ ( [ $( $t: tt) * ] [ $( $p: tt) * ] ) => {
82
+ $( $t) * (
84
83
/// The primitive boolean type. Written as `bool`.
85
84
TyBool ,
86
85
@@ -169,9 +168,24 @@ pub enum TypeVariants<'tcx> {
169
168
170
169
/// A placeholder for a type which could not be computed; this is
171
170
/// propagated to avoid useless error messages.
172
- TyError ,
171
+ TyError , ) $( $p) *
172
+ }
173
173
}
174
174
175
+ macro_rules! declare_type_variants {
176
+ ( $( $t: tt) * ) => {
177
+ /// NB: If you change this, you'll probably want to change the corresponding
178
+ /// AST structure in libsyntax/ast.rs as well.
179
+ #[ derive( Clone , PartialEq , Eq , Hash , Debug , RustcEncodable , RustcDecodable ) ]
180
+ pub enum TypeVariants <' tcx> {
181
+ $( $t) *
182
+ }
183
+ }
184
+ }
185
+
186
+ type_variants ! ( [ declare_type_variants!] [ ; ] ) ;
187
+
188
+
175
189
/// A closure can be modeled as a struct that looks like:
176
190
///
177
191
/// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {
0 commit comments