Skip to content

Commit

Permalink
don't use the moral equivalent of assert!(false, "foo")
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 31, 2023
1 parent ffb7ed9 commit 7c673db
Showing 1 changed file with 22 additions and 33 deletions.
55 changes: 22 additions & 33 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1470,15 +1470,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
match element_ty2.kind() {
ty::Int(_) => (),
_ => {
require!(
false,
InvalidMonomorphization::ThirdArgElementType {
span,
name,
expected_element: element_ty2,
third_arg: arg_tys[2]
}
);
return_error!(InvalidMonomorphization::ThirdArgElementType {
span,
name,
expected_element: element_ty2,
third_arg: arg_tys[2]
});
}
}

Expand Down Expand Up @@ -1590,15 +1587,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
match element_ty2.kind() {
ty::Int(_) => (),
_ => {
require!(
false,
InvalidMonomorphization::ThirdArgElementType {
span,
name,
expected_element: element_ty2,
third_arg: arg_tys[2]
}
);
return_error!(InvalidMonomorphization::ThirdArgElementType {
span,
name,
expected_element: element_ty2,
third_arg: arg_tys[2]
});
}
}

Expand Down Expand Up @@ -1989,17 +1983,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
}
_ => { /* Unsupported. Fallthrough. */ }
}
require!(
false,
InvalidMonomorphization::UnsupportedCast {
span,
name,
in_ty,
in_elem,
ret_ty,
out_elem
}
);
return_error!(InvalidMonomorphization::UnsupportedCast {
span,
name,
in_ty,
in_elem,
ret_ty,
out_elem
});
}
macro_rules! arith_binary {
($($name: ident: $($($p: ident),* => $call: ident),*;)*) => {
Expand All @@ -2010,8 +2001,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
})*
_ => {},
}
require!(
false,
return_error!(
InvalidMonomorphization::UnsupportedOperation { span, name, in_ty, in_elem }
);
})*
Expand Down Expand Up @@ -2041,8 +2031,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
})*
_ => {},
}
require!(
false,
return_error!(
InvalidMonomorphization::UnsupportedOperation { span, name, in_ty, in_elem }
);
})*
Expand Down

0 comments on commit 7c673db

Please sign in to comment.