Skip to content

Commit a17a1b4

Browse files
fix: updated function definition of "from_c" in IntrinsicTypeDefinition
trait to make the same dyn-compatible.
1 parent e0e82ca commit a17a1b4

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

crates/intrinsic-test/src/arm/json_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn json_to_intrinsic(
110110
Ok(Intrinsic {
111111
name,
112112
arguments,
113-
results: *results,
113+
results: results,
114114
arch_tags: intr.architectures,
115115
})
116116
}

crates/intrinsic-test/src/arm/types.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
119119
}
120120
}
121121

122-
fn from_c(s: &str, target: &String) -> Result<Box<Self>, String> {
122+
fn from_c(s: &str, target: &String) -> Result<Self, String> {
123123
const CONST_STR: &str = "const";
124124
if let Some(s) = s.strip_suffix('*') {
125125
let (s, constant) = match s.trim().strip_suffix(CONST_STR) {
@@ -129,9 +129,8 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
129129
let s = s.trim_end();
130130
let temp_return = ArmIntrinsicType::from_c(s, target);
131131
temp_return.and_then(|mut op| {
132-
let edited = op.as_mut();
133-
edited.0.ptr = true;
134-
edited.0.ptr_constant = constant;
132+
op.0.ptr = true;
133+
op.0.ptr_constant = constant;
135134
Ok(op)
136135
})
137136
} else {
@@ -161,7 +160,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
161160
),
162161
None => None,
163162
};
164-
Ok(Box::new(ArmIntrinsicType(IntrinsicType {
163+
Ok(ArmIntrinsicType(IntrinsicType {
165164
ptr: false,
166165
ptr_constant: false,
167166
constant,
@@ -170,14 +169,14 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
170169
simd_len,
171170
vec_len,
172171
target: target.to_string(),
173-
})))
172+
}))
174173
} else {
175174
let kind = start.parse::<TypeKind>()?;
176175
let bit_len = match kind {
177176
TypeKind::Int => Some(32),
178177
_ => None,
179178
};
180-
Ok(Box::new(ArmIntrinsicType(IntrinsicType {
179+
Ok(ArmIntrinsicType(IntrinsicType {
181180
ptr: false,
182181
ptr_constant: false,
183182
constant,
@@ -186,7 +185,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
186185
simd_len: None,
187186
vec_len: None,
188187
target: target.to_string(),
189-
})))
188+
}))
190189
}
191190
}
192191
}

crates/intrinsic-test/src/common/argument.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
Argument {
7777
pos,
7878
name: String::from(var_name),
79-
ty: *ty,
79+
ty: ty,
8080
constraint,
8181
}
8282
}

crates/intrinsic-test/src/common/intrinsic_helpers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ pub trait IntrinsicTypeDefinition: Deref<Target = IntrinsicType> {
282282
fn get_lane_function(&self) -> String;
283283

284284
/// can be implemented in an `impl` block
285-
fn from_c(_s: &str, _target: &String) -> Result<Box<Self>, String>;
285+
fn from_c(_s: &str, _target: &String) -> Result<Self, String>
286+
where
287+
Self: Sized;
286288

287289
/// Gets a string containing the typename for this type in C format.
288290
/// can be directly defined in `impl` blocks

0 commit comments

Comments
 (0)