File tree Expand file tree Collapse file tree 3 files changed +7
-13
lines changed
crates/intrinsic-test/src/common Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ use std::ops::Range;
5
5
pub enum Constraint {
6
6
Equal ( i64 ) ,
7
7
Range ( Range < i64 > ) ,
8
+ Set ( Vec < i64 > ) ,
8
9
}
9
10
10
11
impl Constraint {
11
- pub fn to_range ( & self ) -> Range < i64 > {
12
+ pub fn to_vector ( & self ) -> Vec < i64 > {
12
13
match self {
13
- Constraint :: Equal ( eq) => * eq..* eq + 1 ,
14
- Constraint :: Range ( range) => range. clone ( ) ,
14
+ Constraint :: Equal ( eq) => vec ! [ * eq] ,
15
+ Constraint :: Range ( range) => range. clone ( ) . collect :: < Vec < i64 > > ( ) ,
16
+ Constraint :: Set ( values) => values. clone ( ) ,
15
17
}
16
18
}
17
19
}
Original file line number Diff line number Diff line change @@ -128,11 +128,7 @@ pub fn generate_c_constraint_blocks<T: IntrinsicTypeDefinition>(
128
128
target : & str ,
129
129
) -> String {
130
130
if let Some ( ( current, constraints) ) = constraints. split_last ( ) {
131
- let range = current
132
- . constraint
133
- . iter ( )
134
- . map ( |c| c. to_range ( ) )
135
- . flat_map ( |r| r. into_iter ( ) ) ;
131
+ let range = current. constraint . iter ( ) . flat_map ( |c| c. to_vector ( ) ) ;
136
132
137
133
let body_indentation = indentation. nested ( ) ;
138
134
range
Original file line number Diff line number Diff line change @@ -177,11 +177,7 @@ pub fn generate_rust_constraint_blocks<T: IntrinsicTypeDefinition>(
177
177
name : String ,
178
178
) -> String {
179
179
if let Some ( ( current, constraints) ) = constraints. split_last ( ) {
180
- let range = current
181
- . constraint
182
- . iter ( )
183
- . map ( |c| c. to_range ( ) )
184
- . flat_map ( |r| r. into_iter ( ) ) ;
180
+ let range = current. constraint . iter ( ) . flat_map ( |c| c. to_vector ( ) ) ;
185
181
186
182
let body_indentation = indentation. nested ( ) ;
187
183
range
You can’t perform that action at this time.
0 commit comments