Skip to content

Commit abb5a63

Browse files
committed
wip
1 parent 89d711d commit abb5a63

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/librustc/ty/sty.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ impl BoundRegion {
7777
}
7878
}
7979

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)*(
8483
/// The primitive boolean type. Written as `bool`.
8584
TyBool,
8685

@@ -169,9 +168,24 @@ pub enum TypeVariants<'tcx> {
169168

170169
/// A placeholder for a type which could not be computed; this is
171170
/// propagated to avoid useless error messages.
172-
TyError,
171+
TyError,)$($p)*
172+
}
173173
}
174174

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+
175189
/// A closure can be modeled as a struct that looks like:
176190
///
177191
/// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {

0 commit comments

Comments
 (0)