Module std::intrinsics
[−]
[src]
core_intrinsics
): 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/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 
drop_in_place^{⚠} 
Executes the destructor (if any) of the pointedto value. 
transmute^{⚠} 
Reinterprets the bits of a value of one type as 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.
The stabilized versions of this intrinsic are available on the integer
primitives via the 
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] Bitwise and with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_and_acq^{⚠} 
[Unstable] Bitwise and with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_and_acqrel^{⚠} 
[Unstable] Bitwise and with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_and_rel^{⚠} 
[Unstable] Bitwise and with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_and_relaxed^{⚠} 
[Unstable] Bitwise and with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_cxchg^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_acq^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_acq_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_acqrel^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_acqrel_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_failacq^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_rel^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchg_relaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_acq^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_acq_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_acqrel^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_acqrel_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_failacq^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_failrelaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_rel^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_cxchgweak_relaxed^{⚠} 
[Unstable] Stores a value if the current value is the same as the 
atomic_fence^{⚠}  [Unstable] 
atomic_fence_acq^{⚠}  [Unstable] 
atomic_fence_acqrel^{⚠}  [Unstable] 
atomic_fence_rel^{⚠}  [Unstable] 
atomic_load^{⚠} 
[Unstable] Loads the current value of the pointer.
The stabilized version of this intrinsic is available on the

atomic_load_acq^{⚠} 
[Unstable] Loads the current value of the pointer.
The stabilized version of this intrinsic is available on the

atomic_load_relaxed^{⚠} 
[Unstable] Loads the current value of the pointer.
The stabilized version of this intrinsic is available on the

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] Bitwise nand with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_nand_acq^{⚠} 
[Unstable] Bitwise nand with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_nand_acqrel^{⚠} 
[Unstable] Bitwise nand with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_nand_rel^{⚠} 
[Unstable] Bitwise nand with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_nand_relaxed^{⚠} 
[Unstable] Bitwise nand with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_or^{⚠} 
[Unstable] Bitwise or with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_or_acq^{⚠} 
[Unstable] Bitwise or with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_or_acqrel^{⚠} 
[Unstable] Bitwise or with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_or_rel^{⚠} 
[Unstable] Bitwise or with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_or_relaxed^{⚠} 
[Unstable] Bitwise or with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_singlethreadfence^{⚠} 
[Unstable] A compileronly memory barrier. 
atomic_singlethreadfence_acq^{⚠}  [Unstable] 
atomic_singlethreadfence_acqrel^{⚠}  [Unstable] 
atomic_singlethreadfence_rel^{⚠}  [Unstable] 
atomic_store^{⚠} 
[Unstable] Stores the value at the specified memory location.
The stabilized version of this intrinsic is available on the

atomic_store_rel^{⚠} 
[Unstable] Stores the value at the specified memory location.
The stabilized version of this intrinsic is available on the

atomic_store_relaxed^{⚠} 
[Unstable] Stores the value at the specified memory location.
The stabilized version of this intrinsic is available on the

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] Add to the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xadd_acq^{⚠} 
[Unstable] Add to the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xadd_acqrel^{⚠} 
[Unstable] Add to the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xadd_rel^{⚠} 
[Unstable] Add to the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xadd_relaxed^{⚠} 
[Unstable] Add to the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xchg^{⚠} 
[Unstable] Stores the value at the specified memory location, returning the old value.
The stabilized version of this intrinsic is available on the

atomic_xchg_acq^{⚠} 
[Unstable] Stores the value at the specified memory location, returning the old value.
The stabilized version of this intrinsic is available on the

atomic_xchg_acqrel^{⚠} 
[Unstable] Stores the value at the specified memory location, returning the old value.
The stabilized version of this intrinsic is available on the

atomic_xchg_rel^{⚠} 
[Unstable] Stores the value at the specified memory location, returning the old value.
The stabilized version of this intrinsic is available on the

atomic_xchg_relaxed^{⚠} 
[Unstable] Stores the value at the specified memory location, returning the old value.
The stabilized version of this intrinsic is available on the

atomic_xor^{⚠} 
[Unstable] Bitwise xor with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xor_acq^{⚠} 
[Unstable] Bitwise xor with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xor_acqrel^{⚠} 
[Unstable] Bitwise xor with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xor_rel^{⚠} 
[Unstable] Bitwise xor with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xor_relaxed^{⚠} 
[Unstable] Bitwise xor with the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xsub^{⚠} 
[Unstable] Subtract from the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xsub_acq^{⚠} 
[Unstable] Subtract from the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xsub_acqrel^{⚠} 
[Unstable] Subtract from the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xsub_rel^{⚠} 
[Unstable] Subtract from the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

atomic_xsub_relaxed^{⚠} 
[Unstable] Subtract from the current value, returning the previous value.
The stabilized version of this intrinsic is available on the

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 
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 
fadd_fast^{⚠} 
[Unstable] Float addition that allows optimizations based on algebraic rules. May assume inputs are finite. 
fdiv_fast^{⚠} 
[Unstable] Float division that allows optimizations based on algebraic rules. May assume inputs are finite. 
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 
fmul_fast^{⚠} 
[Unstable] Float multiplication that allows optimizations based on algebraic rules. May assume inputs are finite. 
forget^{⚠} 
[Unstable] Moves a value out of scope without running drop glue. 
frem_fast^{⚠} 
[Unstable] Float remainder that allows optimizations based on algebraic rules. May assume inputs are finite. 
fsub_fast^{⚠} 
[Unstable] Float subtraction that allows optimizations based on algebraic rules. May assume inputs are finite. 
init^{⚠} 
[Unstable] Creates a value initialized to zero. 
likely^{⚠} 
[Unstable] Hints to the compiler that branch condition is likely to be true. Returns the value passed to it. 
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
The stabilized versions of this intrinsic are available on the integer
primitives via the 
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 2^{N,} where N is the width of T in bits.
The stabilized versions of this intrinsic are available on the integer
primitives via the 
overflowing_mul^{⚠} 
[Unstable] Returns (a * b) mod 2^{N,} where N is the width of T in bits.
The stabilized versions of this intrinsic are available on the integer
primitives via the 
overflowing_sub^{⚠} 
[Unstable] Returns (a  b) mod 2^{N,} where N is the width of T in bits.
The stabilized versions of this intrinsic are available on the integer
primitives via the 
powf32^{⚠} 
[Unstable] Raises an 
powf64^{⚠} 
[Unstable] Raises an 
powif32^{⚠} 
[Unstable] Raises an 
powif64^{⚠} 
[Unstable] Raises an 
pref_align_of^{⚠}  [Unstable] 
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 
rustc_peek^{⚠} 
[Unstable] Magic intrinsic that derives its meaning from attributes attached to the function. 
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
The stabilized versions of this intrinsic are available on the integer
primitives via the 
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. 
unlikely^{⚠} 
[Unstable] Hints to the compiler that branch condition is likely to be false. Returns the value passed to it. 
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 