Skip to content

Commit a9b90c0

Browse files
committed
rustc_mir: remove redundant wrapping of return type in numeric_intrinsic()
1 parent 76b9b16 commit a9b90c0

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

compiler/rustc_mir/src/interpret/intrinsics.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ use super::{
2323
mod caller_location;
2424
mod type_name;
2525

26-
fn numeric_intrinsic<'tcx, Tag>(
27-
name: Symbol,
28-
bits: u128,
29-
kind: Primitive,
30-
) -> InterpResult<'tcx, Scalar<Tag>> {
26+
fn numeric_intrinsic<Tag>(name: Symbol, bits: u128, kind: Primitive) -> Scalar<Tag> {
3127
let size = match kind {
3228
Primitive::Int(integer, _) => integer.size(),
3329
_ => bug!("invalid `{}` argument: {:?}", name, bits),
@@ -41,7 +37,7 @@ fn numeric_intrinsic<'tcx, Tag>(
4137
sym::bitreverse => (bits << extra).reverse_bits(),
4238
_ => bug!("not a numeric intrinsic: {}", name),
4339
};
44-
Ok(Scalar::from_uint(bits_out, size))
40+
Scalar::from_uint(bits_out, size)
4541
}
4642

4743
/// The logic for all nullary intrinsics is implemented here. These intrinsics don't get evaluated
@@ -208,7 +204,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
208204
if nonzero && bits == 0 {
209205
throw_ub_format!("`{}_nonzero` called on 0", intrinsic_name);
210206
}
211-
let out_val = numeric_intrinsic(intrinsic_name, bits, kind)?;
207+
let out_val = numeric_intrinsic(intrinsic_name, bits, kind);
212208
self.write_scalar(out_val, dest)?;
213209
}
214210
sym::add_with_overflow | sym::sub_with_overflow | sym::mul_with_overflow => {

0 commit comments

Comments
 (0)