@@ -106,6 +106,8 @@ enum LockstepIterSize {
106
106
LisContradiction ( String ) ,
107
107
}
108
108
109
+ // NOTE(stage0): Remove impl after a snapshot
110
+ #[ cfg( stage0) ]
109
111
impl Add < LockstepIterSize , LockstepIterSize > for LockstepIterSize {
110
112
fn add ( & self , other : & LockstepIterSize ) -> LockstepIterSize {
111
113
match * self {
@@ -127,6 +129,28 @@ impl Add<LockstepIterSize, LockstepIterSize> for LockstepIterSize {
127
129
}
128
130
}
129
131
132
+ #[ cfg( not( stage0) ) ] // NOTE(stage0): Remove cfg after a snapshot
133
+ impl Add < LockstepIterSize , LockstepIterSize > for LockstepIterSize {
134
+ fn add ( self , other : LockstepIterSize ) -> LockstepIterSize {
135
+ match self {
136
+ LisUnconstrained => other,
137
+ LisContradiction ( _) => self ,
138
+ LisConstraint ( l_len, ref l_id) => match other {
139
+ LisUnconstrained => self . clone ( ) ,
140
+ LisContradiction ( _) => other,
141
+ LisConstraint ( r_len, _) if l_len == r_len => self . clone ( ) ,
142
+ LisConstraint ( r_len, r_id) => {
143
+ let l_n = token:: get_ident ( l_id. clone ( ) ) ;
144
+ let r_n = token:: get_ident ( r_id) ;
145
+ LisContradiction ( format ! ( "inconsistent lockstep iteration: \
146
+ '{}' has {} items, but '{}' has {}",
147
+ l_n, l_len, r_n, r_len) . to_string ( ) )
148
+ }
149
+ } ,
150
+ }
151
+ }
152
+ }
153
+
130
154
fn lockstep_iter_size ( t : & TokenTree , r : & TtReader ) -> LockstepIterSize {
131
155
match * t {
132
156
TtDelimited ( _, ref delimed) => {
0 commit comments