Module core::intrinsics
[−]
[src]
core_intrinsics
#0): intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
rustc compiler intrinsics.
The corresponding definitions are in librustc_trans/trans/intrinsic.rs.
Volatiles
The volatile intrinsics provide operations intended to act on I/O memory, which are guaranteed to not be reordered by the compiler across other volatile intrinsics. See the LLVM documentation on [volatile].
Atomics
The atomic intrinsics provide common atomic operations on machine words, with multiple possible memory orderings. They obey the same semantics as C++11. See the LLVM documentation on [atomics].
A quick refresher on memory ordering:
- Acquire - a barrier for acquiring a lock. Subsequent reads and writes take place after the barrier.
- Release - a barrier for releasing a lock. Preceding reads and writes take place before the barrier.
- Sequentially consistent - sequentially consistent operations are
guaranteed to happen in order. This is the standard mode for working
with atomic types and is equivalent to Java's
volatile
.
Functions
copy |
Copies |
copy_nonoverlapping |
Copies |
transmute |
Unsafely transforms a value of one type into a value of another type. |
write_bytes |
Invokes memset on the specified pointer, setting |
abort |
[Unstable] Aborts the execution of the process. |
add_with_overflow |
[Unstable] Performs checked integer addition. |
arith_offset |
[Unstable] Calculates the offset from a pointer, potentially wrapping. |
assume |
[Unstable] Informs the optimizer that a condition is always true. If the condition is false, the behavior is undefined. |
atomic_and | [Unstable] |
atomic_and_acq | [Unstable] |
atomic_and_acqrel | [Unstable] |
atomic_and_rel | [Unstable] |
atomic_and_relaxed | [Unstable] |
atomic_cxchg | [Unstable] |
atomic_cxchg_acq | [Unstable] |
atomic_cxchg_acqrel | [Unstable] |
atomic_cxchg_rel | [Unstable] |
atomic_cxchg_relaxed | [Unstable] |
atomic_fence | [Unstable] |
atomic_fence_acq | [Unstable] |
atomic_fence_acqrel | [Unstable] |
atomic_fence_rel | [Unstable] |
atomic_load | [Unstable] |
atomic_load_acq | [Unstable] |
atomic_load_relaxed | [Unstable] |
atomic_load_unordered | [Unstable] |
atomic_max | [Unstable] |
atomic_max_acq | [Unstable] |
atomic_max_acqrel | [Unstable] |
atomic_max_rel | [Unstable] |
atomic_max_relaxed | [Unstable] |
atomic_min | [Unstable] |
atomic_min_acq | [Unstable] |
atomic_min_acqrel | [Unstable] |
atomic_min_rel | [Unstable] |
atomic_min_relaxed | [Unstable] |
atomic_nand | [Unstable] |
atomic_nand_acq | [Unstable] |
atomic_nand_acqrel | [Unstable] |
atomic_nand_rel | [Unstable] |
atomic_nand_relaxed | [Unstable] |
atomic_or | [Unstable] |
atomic_or_acq | [Unstable] |
atomic_or_acqrel | [Unstable] |
atomic_or_rel | [Unstable] |
atomic_or_relaxed | [Unstable] |
atomic_singlethreadfence |
[Unstable] A compiler-only memory barrier. |
atomic_singlethreadfence_acq | [Unstable] |
atomic_singlethreadfence_acqrel | [Unstable] |
atomic_singlethreadfence_rel | [Unstable] |
atomic_store | [Unstable] |
atomic_store_rel | [Unstable] |
atomic_store_relaxed | [Unstable] |
atomic_store_unordered | [Unstable] |
atomic_umax | [Unstable] |
atomic_umax_acq | [Unstable] |
atomic_umax_acqrel | [Unstable] |
atomic_umax_rel | [Unstable] |
atomic_umax_relaxed | [Unstable] |
atomic_umin | [Unstable] |
atomic_umin_acq | [Unstable] |
atomic_umin_acqrel | [Unstable] |
atomic_umin_rel | [Unstable] |
atomic_umin_relaxed | [Unstable] |
atomic_xadd | [Unstable] |
atomic_xadd_acq | [Unstable] |
atomic_xadd_acqrel | [Unstable] |
atomic_xadd_rel | [Unstable] |
atomic_xadd_relaxed | [Unstable] |
atomic_xchg | [Unstable] |
atomic_xchg_acq | [Unstable] |
atomic_xchg_acqrel | [Unstable] |
atomic_xchg_rel | [Unstable] |
atomic_xchg_relaxed | [Unstable] |
atomic_xor | [Unstable] |
atomic_xor_acq | [Unstable] |
atomic_xor_acqrel | [Unstable] |
atomic_xor_rel | [Unstable] |
atomic_xor_relaxed | [Unstable] |
atomic_xsub | [Unstable] |
atomic_xsub_acq | [Unstable] |
atomic_xsub_acqrel | [Unstable] |
atomic_xsub_rel | [Unstable] |
atomic_xsub_relaxed | [Unstable] |
breakpoint |
[Unstable] Executes a breakpoint trap, for inspection by a debugger. |
bswap |
[Unstable] Reverses the bytes in an integer type |
ceilf32 |
[Unstable] Returns the smallest integer greater than or equal to an |
ceilf64 |
[Unstable] Returns the smallest integer greater than or equal to an |
copysignf32 |
[Unstable] Copies the sign from |
copysignf64 |
[Unstable] Copies the sign from |
cosf32 |
[Unstable] Returns the cosine of an |
cosf64 |
[Unstable] Returns the cosine of an |
ctlz |
[Unstable] Returns the number of leading bits unset in an integer type |
ctpop |
[Unstable] Returns the number of bits set in an integer type |
cttz |
[Unstable] Returns the number of trailing bits unset in an integer type |
discriminant_value |
[Unstable] Returns the value of the discriminant for the variant in 'v',
cast to a |
drop_in_place |
[Unstable] Executes the destructor (if any) of the pointed-to value. |
exp2f32 |
[Unstable] Returns 2 raised to the power of an |
exp2f64 |
[Unstable] Returns 2 raised to the power of an |
expf32 |
[Unstable] Returns the exponential of an |
expf64 |
[Unstable] Returns the exponential of an |
fabsf32 |
[Unstable] Returns the absolute value of an |
fabsf64 |
[Unstable] Returns the absolute value of an |
floorf32 |
[Unstable] Returns the largest integer less than or equal to an |
floorf64 |
[Unstable] Returns the largest integer less than or equal to an |
fmaf32 |
[Unstable] Returns |
fmaf64 |
[Unstable] Returns |
forget |
[Unstable] Moves a value out of scope without running drop glue. |
init |
[Unstable] Creates a value initialized to zero. |
init_dropped |
[Unstable] Creates a value initialized to so that its drop flag, if any, says that it has been dropped. |
log10f32 |
[Unstable] Returns the base 10 logarithm of an |
log10f64 |
[Unstable] Returns the base 10 logarithm of an |
log2f32 |
[Unstable] Returns the base 2 logarithm of an |
log2f64 |
[Unstable] Returns the base 2 logarithm of an |
logf32 |
[Unstable] Returns the natural logarithm of an |
logf64 |
[Unstable] Returns the natural logarithm of an |
min_align_of | [Unstable] |
min_align_of_val | [Unstable] |
move_val_init |
[Unstable] Moves a value to an uninitialized memory location. |
mul_with_overflow |
[Unstable] Performs checked integer multiplication |
nearbyintf32 |
[Unstable] Returns the nearest integer to an |
nearbyintf64 |
[Unstable] Returns the nearest integer to an |
needs_drop |
[Unstable] Returns |
offset |
[Unstable] Calculates the offset from a pointer. |
overflowing_add |
[Unstable] Returns (a + b) mod 2N, where N is the width of T in bits. |
overflowing_mul |
[Unstable] Returns (a * b) mod 2N, where N is the width of T in bits. |
overflowing_sub |
[Unstable] Returns (a - b) mod 2N, where N is the width of T in bits. |
powf32 |
[Unstable] Raises an |
powf64 |
[Unstable] Raises an |
powif32 |
[Unstable] Raises an |
powif64 |
[Unstable] Raises an |
pref_align_of | [Unstable] |
return_address |
[Unstable] Gives the address for the return value of the enclosing function. |
rintf32 |
[Unstable] Returns the nearest integer to an |
rintf64 |
[Unstable] Returns the nearest integer to an |
roundf32 |
[Unstable] Returns the nearest integer to an |
roundf64 |
[Unstable] Returns the nearest integer to an |
sinf32 |
[Unstable] Returns the sine of an |
sinf64 |
[Unstable] Returns the sine of an |
size_of |
[Unstable] The size of a type in bytes. |
size_of_val | [Unstable] |
sqrtf32 |
[Unstable] Returns the square root of an |
sqrtf64 |
[Unstable] Returns the square root of an |
sub_with_overflow |
[Unstable] Performs checked integer subtraction |
truncf32 |
[Unstable] Returns the integer part of an |
truncf64 |
[Unstable] Returns the integer part of an |
try |
[Unstable] Rust's "try catch" construct which invokes the function pointer |
type_id |
[Unstable] Gets an identifier which is globally unique to the specified type. This function will return the same value for a type regardless of whichever crate it is invoked in. |
type_name |
[Unstable] Gets a static string slice containing the name of a type. |
unchecked_div |
[Unstable] Performs an unchecked division, resulting in undefined behavior
where y = 0 or x = |
unchecked_rem |
[Unstable] Returns the remainder of an unchecked division, resulting in
undefined behavior where y = 0 or x = |
uninit |
[Unstable] Creates an uninitialized value. |
unreachable |
[Unstable] Tells LLVM that this point in the code is not reachable, enabling further optimizations. |
volatile_copy_memory |
[Unstable] Equivalent to the appropriate |
volatile_copy_nonoverlapping_memory |
[Unstable] Equivalent to the appropriate |
volatile_load |
[Unstable] Perform a volatile load from the |
volatile_set_memory |
[Unstable] Equivalent to the appropriate |
volatile_store |
[Unstable] Perform a volatile store to the |