Skip to content

Commit 7c673db

Browse files
committed
don't use the moral equivalent of assert!(false, "foo")
1 parent ffb7ed9 commit 7c673db

File tree

1 file changed

+22
-33
lines changed

1 file changed

+22
-33
lines changed

compiler/rustc_codegen_llvm/src/intrinsic.rs

+22-33
Original file line numberDiff line numberDiff line change
@@ -1470,15 +1470,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
14701470
match element_ty2.kind() {
14711471
ty::Int(_) => (),
14721472
_ => {
1473-
require!(
1474-
false,
1475-
InvalidMonomorphization::ThirdArgElementType {
1476-
span,
1477-
name,
1478-
expected_element: element_ty2,
1479-
third_arg: arg_tys[2]
1480-
}
1481-
);
1473+
return_error!(InvalidMonomorphization::ThirdArgElementType {
1474+
span,
1475+
name,
1476+
expected_element: element_ty2,
1477+
third_arg: arg_tys[2]
1478+
});
14821479
}
14831480
}
14841481

@@ -1590,15 +1587,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
15901587
match element_ty2.kind() {
15911588
ty::Int(_) => (),
15921589
_ => {
1593-
require!(
1594-
false,
1595-
InvalidMonomorphization::ThirdArgElementType {
1596-
span,
1597-
name,
1598-
expected_element: element_ty2,
1599-
third_arg: arg_tys[2]
1600-
}
1601-
);
1590+
return_error!(InvalidMonomorphization::ThirdArgElementType {
1591+
span,
1592+
name,
1593+
expected_element: element_ty2,
1594+
third_arg: arg_tys[2]
1595+
});
16021596
}
16031597
}
16041598

@@ -1989,17 +1983,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
19891983
}
19901984
_ => { /* Unsupported. Fallthrough. */ }
19911985
}
1992-
require!(
1993-
false,
1994-
InvalidMonomorphization::UnsupportedCast {
1995-
span,
1996-
name,
1997-
in_ty,
1998-
in_elem,
1999-
ret_ty,
2000-
out_elem
2001-
}
2002-
);
1986+
return_error!(InvalidMonomorphization::UnsupportedCast {
1987+
span,
1988+
name,
1989+
in_ty,
1990+
in_elem,
1991+
ret_ty,
1992+
out_elem
1993+
});
20031994
}
20041995
macro_rules! arith_binary {
20051996
($($name: ident: $($($p: ident),* => $call: ident),*;)*) => {
@@ -2010,8 +2001,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20102001
})*
20112002
_ => {},
20122003
}
2013-
require!(
2014-
false,
2004+
return_error!(
20152005
InvalidMonomorphization::UnsupportedOperation { span, name, in_ty, in_elem }
20162006
);
20172007
})*
@@ -2041,8 +2031,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20412031
})*
20422032
_ => {},
20432033
}
2044-
require!(
2045-
false,
2034+
return_error!(
20462035
InvalidMonomorphization::UnsupportedOperation { span, name, in_ty, in_elem }
20472036
);
20482037
})*

0 commit comments

Comments
 (0)