Module std::intrinsics [] [src]

Unstable

: 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:

Functions

copy

Copies count * size_of<T> bytes from src`srcto` to dst`dst`. The source and destination may overlap.

copy_nonoverlapping

Copies count * size_of<T> bytes from src`srcto` to dst`dst`. The source and destination may not overlap.

transmute

Unsafely transforms a value of one type into a value of another type.

write_bytes

Invokes memset on the specified pointer, setting count * size_of::<T>() bytes of memory starting at dst`dstto` to c`c`.

abort [Unstable]

Aborts the execution of the process.

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.

bswap16 [Unstable]

Reverses the bytes in a u16`u16`.

bswap32 [Unstable]

Reverses the bytes in a u32`u32`.

bswap64 [Unstable]

Reverses the bytes in a u64`u64`.

ceilf32 [Unstable]

Returns the smallest integer greater than or equal to an f32`f32`.

ceilf64 [Unstable]

Returns the smallest integer greater than or equal to an f64`f64`.

copysignf32 [Unstable]

Copies the sign from y`yto` to x`xfor` for f32`f32` values.

copysignf64 [Unstable]

Copies the sign from y`yto` to x`xfor` for f64`f64` values.

cosf32 [Unstable]

Returns the cosine of an f32`f32`.

cosf64 [Unstable]

Returns the cosine of an f64`f64`.

ctlz16 [Unstable]

Returns the number of leading bits unset in a u16`u16`.

ctlz32 [Unstable]

Returns the number of leading bits unset in a u32`u32`.

ctlz64 [Unstable]

Returns the number of leading bits unset in a u64`u64`.

ctlz8 [Unstable]

Returns the number of leading bits unset in a u8`u8`.

ctpop16 [Unstable]

Returns the number of bits set in a u16`u16`.

ctpop32 [Unstable]

Returns the number of bits set in a u32`u32`.

ctpop64 [Unstable]

Returns the number of bits set in a u64`u64`.

ctpop8 [Unstable]

Returns the number of bits set in a u8`u8`.

cttz16 [Unstable]

Returns the number of trailing bits unset in a u16`u16`.

cttz32 [Unstable]

Returns the number of trailing bits unset in a u32`u32`.

cttz64 [Unstable]

Returns the number of trailing bits unset in a u64`u64`.

cttz8 [Unstable]

Returns the number of trailing bits unset in a u8`u8`.

discriminant_value [Unstable]

Returns the value of the discriminant for the variant in 'v', cast to a u64`u64; if`; if T`T` has no discriminant, returns 0.

drop_in_place [Unstable]
exp2f32 [Unstable]

Returns 2 raised to the power of an f32`f32`.

exp2f64 [Unstable]

Returns 2 raised to the power of an f64`f64`.

expf32 [Unstable]

Returns the exponential of an f32`f32`.

expf64 [Unstable]

Returns the exponential of an f64`f64`.

fabsf32 [Unstable]

Returns the absolute value of an f32`f32`.

fabsf64 [Unstable]

Returns the absolute value of an f64`f64`.

floorf32 [Unstable]

Returns the largest integer less than or equal to an f32`f32`.

floorf64 [Unstable]

Returns the largest integer less than or equal to an f64`f64`.

fmaf32 [Unstable]

Returns a * b + c for f32`f32` values.

fmaf64 [Unstable]

Returns a * b + c for f64`f64` values.

forget [Unstable]

Moves a value out of scope without running drop glue.

i16_add_with_overflow [Unstable]

Performs checked i16`i16` addition.

i16_mul_with_overflow [Unstable]

Performs checked i16`i16` multiplication.

i16_sub_with_overflow [Unstable]

Performs checked i16`i16` subtraction.

i32_add_with_overflow [Unstable]

Performs checked i32`i32` addition.

i32_mul_with_overflow [Unstable]

Performs checked i32`i32` multiplication.

i32_sub_with_overflow [Unstable]

Performs checked i32`i32` subtraction.

i64_add_with_overflow [Unstable]

Performs checked i64`i64` addition.

i64_mul_with_overflow [Unstable]

Performs checked i64`i64` multiplication.

i64_sub_with_overflow [Unstable]

Performs checked i64`i64` subtraction.

i8_add_with_overflow [Unstable]

Performs checked i8`i8` addition.

i8_mul_with_overflow [Unstable]

Performs checked i8`i8` multiplication.

i8_sub_with_overflow [Unstable]

Performs checked i8`i8` subtraction.

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 f32`f32`.

log10f64 [Unstable]

Returns the base 10 logarithm of an f64`f64`.

log2f32 [Unstable]

Returns the base 2 logarithm of an f32`f32`.

log2f64 [Unstable]

Returns the base 2 logarithm of an f64`f64`.

logf32 [Unstable]

Returns the natural logarithm of an f32`f32`.

logf64 [Unstable]

Returns the natural logarithm of an f64`f64`.

min_align_of [Unstable]
min_align_of_val [Unstable]
move_val_init [Unstable]

Moves a value to an uninitialized memory location.

nearbyintf32 [Unstable]

Returns the nearest integer to an f32`f32`.

nearbyintf64 [Unstable]

Returns the nearest integer to an f64`f64`.

needs_drop [Unstable]

Returns true`trueif the actual type given asTrequires drop glue; returnsfalseif the actual type provided forTimplementsCopy`.

offset [Unstable]

Calculates the offset from a pointer.

overflowing_add [Unstable]

Returns (a + b) mod 2N, where N is the width of N in bits.

overflowing_mul [Unstable]

Returns (a * b) mod 2N, where N is the width of N in bits.

overflowing_sub [Unstable]

Returns (a - b) mod 2N, where N is the width of N in bits.

powf32 [Unstable]

Raises an f32`f32to an` to an f32`f32` power.

powf64 [Unstable]

Raises an f64`f64to an` to an f64`f64` power.

powif32 [Unstable]

Raises an f32`f32` to an integer power.

powif64 [Unstable]

Raises an f64`f64` to an integer power.

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 f32`f32`. May raise an inexact floating-point exception if the argument is not an integer.

rintf64 [Unstable]

Returns the nearest integer to an f64`f64`. May raise an inexact floating-point exception if the argument is not an integer.

roundf32 [Unstable]

Returns the nearest integer to an f32`f32`. Rounds half-way cases away from zero.

roundf64 [Unstable]

Returns the nearest integer to an f64`f64`. Rounds half-way cases away from zero.

sinf32 [Unstable]

Returns the sine of an f32`f32`.

sinf64 [Unstable]

Returns the sine of an f64`f64`.

size_of [Unstable]

The size of a type in bytes.

size_of_val [Unstable]
sqrtf32 [Unstable]

Returns the square root of an f32`f32`

sqrtf64 [Unstable]

Returns the square root of an f64`f64`

truncf32 [Unstable]

Returns the integer part of an f32`f32`.

truncf64 [Unstable]

Returns the integer part of an f64`f64`.

try [Unstable]

Rust's "try catch" construct which invokes the function pointer f`fwith the data pointerdata`, returning the exception payload if an exception is thrown (aka the thread panics).

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.

u16_add_with_overflow [Unstable]

Performs checked u16`u16` addition.

u16_mul_with_overflow [Unstable]

Performs checked u16`u16` multiplication.

u16_sub_with_overflow [Unstable]

Performs checked u16`u16` subtraction.

u32_add_with_overflow [Unstable]

Performs checked u32`u32` addition.

u32_mul_with_overflow [Unstable]

Performs checked u32`u32` multiplication.

u32_sub_with_overflow [Unstable]

Performs checked u32`u32` subtraction.

u64_add_with_overflow [Unstable]

Performs checked u64`u64` addition.

u64_mul_with_overflow [Unstable]

Performs checked u64`u64` multiplication.

u64_sub_with_overflow [Unstable]

Performs checked u64`u64` subtraction.

u8_add_with_overflow [Unstable]

Performs checked u8`u8` addition.

u8_mul_with_overflow [Unstable]

Performs checked u8`u8` multiplication.

u8_sub_with_overflow [Unstable]

Performs checked u8`u8` subtraction.

unchecked_sdiv [Unstable]

Performs an unchecked signed division, which results in undefined behavior, in cases where y == 0, or x == isize::MIN and y == -1

unchecked_srem [Unstable]

Returns the remainder of an unchecked signed division, which results in undefined behavior, in cases where y == 0, or x == isize::MIN and y == -1

unchecked_udiv [Unstable]

Performs an unchecked unsigned division, which results in undefined behavior, in cases where y == 0

unchecked_urem [Unstable]

Returns the remainder of an unchecked unsigned division, which results in undefined behavior, in cases where y == 0

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 llvm.memmove.p0i8.0i8.* intrinsic, with a size of count`count*` * size_of::<T>() and an alignment of min_align_of::<T>()

volatile_copy_nonoverlapping_memory [Unstable]

Equivalent to the appropriate llvm.memcpy.p0i8.0i8.* intrinsic, with a size of count`count*` * size_of::<T>() and an alignment of min_align_of::<T>()

volatile_load [Unstable]

Perform a volatile load from the src`src` pointer.

volatile_set_memory [Unstable]

Equivalent to the appropriate llvm.memset.p0i8.* intrinsic, with a size of count`count*` * size_of::<T>() and an alignment of min_align_of::<T>().

volatile_store [Unstable]

Perform a volatile store to the dst`dst` pointer.