Update list of safe intrinsics

This commit is contained in:
Lukas Wirth 2021-07-08 15:49:39 +02:00
parent 2b6770c936
commit 13d3928d0b
2 changed files with 51 additions and 50 deletions

View File

@ -795,42 +795,42 @@ enum GenericsOwner<'a> {
/// Returns `true` if the given intrinsic is unsafe to call, or false otherwise.
fn is_intrinsic_fn_unsafe(name: &Name) -> bool {
// Should be kept in sync with https://github.com/rust-lang/rust/blob/c6e4db620a7d2f569f11dcab627430921ea8aacf/compiler/rustc_typeck/src/check/intrinsic.rs#L68
// Should be kept in sync with https://github.com/rust-lang/rust/blob/0cd0709f19d316c4796fa71c5f52c8612a5f3771/compiler/rustc_typeck/src/check/intrinsic.rs#L72-L105
![
known::abort,
known::min_align_of,
known::needs_drop,
known::caller_location,
known::size_of_val,
known::min_align_of_val,
known::add_with_overflow,
known::sub_with_overflow,
known::mul_with_overflow,
known::wrapping_add,
known::wrapping_sub,
known::wrapping_mul,
known::saturating_add,
known::saturating_sub,
known::rotate_left,
known::rotate_right,
known::ctpop,
known::ctlz,
known::cttz,
known::bswap,
known::bitreverse,
known::bswap,
known::caller_location,
known::ctlz,
known::ctpop,
known::cttz,
known::discriminant_value,
known::type_id,
known::forget,
known::likely,
known::unlikely,
known::ptr_guaranteed_eq,
known::ptr_guaranteed_ne,
known::maxnumf32,
known::maxnumf64,
known::min_align_of,
known::minnumf32,
known::minnumf64,
known::maxnumf32,
known::mul_with_overflow,
known::needs_drop,
known::ptr_guaranteed_eq,
known::ptr_guaranteed_ne,
known::rotate_left,
known::rotate_right,
known::rustc_peek,
known::maxnumf64,
known::saturating_add,
known::saturating_sub,
known::size_of,
known::sub_with_overflow,
known::type_id,
known::type_name,
known::unlikely,
known::variant_count,
known::wrapping_add,
known::wrapping_mul,
known::wrapping_sub,
]
.contains(name)
}

View File

@ -249,40 +249,41 @@ pub mod known {
test_case,
// Safe intrinsics
abort,
size_of,
min_align_of,
needs_drop,
caller_location,
size_of_val,
min_align_of_val,
add_with_overflow,
sub_with_overflow,
mul_with_overflow,
wrapping_add,
wrapping_sub,
wrapping_mul,
saturating_add,
saturating_sub,
rotate_left,
rotate_right,
ctpop,
ctlz,
cttz,
bswap,
bitreverse,
bswap,
caller_location,
ctlz,
ctpop,
cttz,
discriminant_value,
type_id,
forget,
likely,
unlikely,
ptr_guaranteed_eq,
ptr_guaranteed_ne,
maxnumf32,
maxnumf64,
min_align_of_val,
min_align_of,
minnumf32,
minnumf64,
maxnumf32,
mul_with_overflow,
needs_drop,
ptr_guaranteed_eq,
ptr_guaranteed_ne,
rotate_left,
rotate_right,
rustc_peek,
maxnumf64,
saturating_add,
saturating_sub,
size_of_val,
size_of,
sub_with_overflow,
type_id,
type_name,
unlikely,
variant_count,
wrapping_add,
wrapping_mul,
wrapping_sub,
);
// self/Self cannot be used as an identifier