core_intrinsics)Expand description
Compiler intrinsics.
The corresponding definitions are in https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs. The corresponding const implementations are in https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs.
§Const intrinsics
Note: any changes to the constness of intrinsics should be discussed with the language team. This includes changes in the stability of the constness.
In order to make an intrinsic usable at compile-time, it needs to be declared in the “new”
style, i.e. as a #[rustc_intrinsic] function, not inside an extern block. Then copy the
implementation from https://github.com/rust-lang/miri/blob/master/src/intrinsics to
https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs
and make the intrinsic declaration a const fn.
If an intrinsic is supposed to be used from a const fn with a rustc_const_stable attribute,
#[rustc_intrinsic_const_stable_indirect] needs to be added to the intrinsic. Such a change requires
T-lang approval, because it may bake a feature into the language that cannot be replicated in
user code without compiler support.
§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.
§Unwinding
Rust intrinsics may, in general, unwind. If an intrinsic can never unwind, add the
#[rustc_nounwind] attribute so that the compiler can make use of this fact.
However, even for intrinsics that may unwind, rustc assumes that a Rust intrinsics will never initiate a foreign (non-Rust) unwind, and thus for panic=abort we can always assume that these intrinsics cannot unwind.
Modules§
- fallbackExperimental 
- mirExperimental 
- Rustc internal tooling for hand-writing MIR.
- simdExperimental 
- SIMD compiler intrinsics.
Traits§
- AggregateRawPtr Experimental 
Functions§
- copy⚠Deprecated 
- Copies count * size_of::<T>()bytes fromsrctodst. The source and destination may overlap.
- copy_nonoverlapping ⚠Deprecated 
- Copies count * size_of::<T>()bytes fromsrctodst. The source and destination must not overlap.
- drop_in_ ⚠place Deprecated 
- transmute⚠Deprecated 
- Reinterprets the bits of a value of one type as another type.
- write_bytes ⚠Deprecated 
- Sets count * size_of::<T>()bytes of memory starting atdsttoval.
- abortExperimental 
- Aborts the execution of the process.
- add_with_ overflow Experimental 
- Performs checked integer addition.
- aggregate_raw_ ptr Experimental 
- Lowers in MIR to Rvalue::AggregatewithAggregateKind::RawPtr.
- arith_offset ⚠Experimental 
- Calculates the offset from a pointer, potentially wrapping.
- assert_inhabited Experimental 
- A guard for unsafe functions that cannot ever be executed if Tis uninhabited: This will statically either panic, or do nothing.
- assert_mem_ uninitialized_ valid Experimental 
- A guard for std::mem::uninitialized. This will statically either panic, or do nothing.
- assert_zero_ valid Experimental 
- A guard for unsafe functions that cannot ever be executed if Tdoes not permit zero-initialization: This will statically either panic, or do nothing.
- assume⚠Experimental 
- Informs the optimizer that a condition is always true. If the condition is false, the behavior is undefined.
- atomic_and_ ⚠acqrel Experimental 
- Bitwise and with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_and_ ⚠acquire Experimental 
- Bitwise and with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_and_ ⚠relaxed Experimental 
- Bitwise and with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_and_ ⚠release Experimental 
- Bitwise and with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_and_ ⚠seqcst Experimental 
- Bitwise and with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_cxchg_ ⚠acqrel_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠acqrel_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠acqrel_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠acquire_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠acquire_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠acquire_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠relaxed_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠relaxed_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠relaxed_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠release_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠release_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠release_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠seqcst_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠seqcst_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchg_ ⚠seqcst_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acqrel_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acqrel_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acqrel_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acquire_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acquire_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠acquire_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠relaxed_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠relaxed_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠relaxed_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠release_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠release_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠release_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠seqcst_ acquire Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠seqcst_ relaxed Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_cxchgweak_ ⚠seqcst_ seqcst Experimental 
- Stores a value if the current value is the same as the oldvalue.Tmust be an integer or pointer type.
- atomic_fence_ ⚠acqrel Experimental 
- An atomic fence.
- atomic_fence_ ⚠acquire Experimental 
- An atomic fence.
- atomic_fence_ ⚠release Experimental 
- An atomic fence.
- atomic_fence_ ⚠seqcst Experimental 
- An atomic fence.
- atomic_load_ ⚠acquire Experimental 
- Loads the current value of the pointer.
Tmust be an integer or pointer type.
- atomic_load_ ⚠relaxed Experimental 
- Loads the current value of the pointer.
Tmust be an integer or pointer type.
- atomic_load_ ⚠seqcst Experimental 
- Loads the current value of the pointer.
Tmust be an integer or pointer type.
- atomic_load_ ⚠unordered Experimental 
- Do NOT use this intrinsic; “unordered” operations do not exist in our memory model!
In terms of the Rust Abstract Machine, this operation is equivalent to src.read(), i.e., it performs a non-atomic read.
- atomic_max_ ⚠acqrel Experimental 
- Maximum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_max_ ⚠acquire Experimental 
- Maximum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_max_ ⚠relaxed Experimental 
- Maximum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_max_ ⚠release Experimental 
- Maximum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_max_ ⚠seqcst Experimental 
- Maximum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_min_ ⚠acqrel Experimental 
- Minimum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_min_ ⚠acquire Experimental 
- Minimum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_min_ ⚠relaxed Experimental 
- Minimum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_min_ ⚠release Experimental 
- Minimum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_min_ ⚠seqcst Experimental 
- Minimum with the current value using a signed comparison.
Tmust be a signed integer type.
- atomic_nand_ ⚠acqrel Experimental 
- Bitwise nand with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_nand_ ⚠acquire Experimental 
- Bitwise nand with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_nand_ ⚠relaxed Experimental 
- Bitwise nand with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_nand_ ⚠release Experimental 
- Bitwise nand with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_nand_ ⚠seqcst Experimental 
- Bitwise nand with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_or_ ⚠acqrel Experimental 
- Bitwise or with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_or_ ⚠acquire Experimental 
- Bitwise or with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_or_ ⚠relaxed Experimental 
- Bitwise or with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_or_ ⚠release Experimental 
- Bitwise or with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_or_ ⚠seqcst Experimental 
- Bitwise or with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_singlethreadfence_ ⚠acqrel Experimental 
- A compiler-only memory barrier.
- atomic_singlethreadfence_ ⚠acquire Experimental 
- A compiler-only memory barrier.
- atomic_singlethreadfence_ ⚠release Experimental 
- A compiler-only memory barrier.
- atomic_singlethreadfence_ ⚠seqcst Experimental 
- A compiler-only memory barrier.
- atomic_store_ ⚠relaxed Experimental 
- Stores the value at the specified memory location.
Tmust be an integer or pointer type.
- atomic_store_ ⚠release Experimental 
- Stores the value at the specified memory location.
Tmust be an integer or pointer type.
- atomic_store_ ⚠seqcst Experimental 
- Stores the value at the specified memory location.
Tmust be an integer or pointer type.
- atomic_store_ ⚠unordered Experimental 
- Do NOT use this intrinsic; “unordered” operations do not exist in our memory model!
In terms of the Rust Abstract Machine, this operation is equivalent to dst.write(val), i.e., it performs a non-atomic write.
- atomic_umax_ ⚠acqrel Experimental 
- Maximum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umax_ ⚠acquire Experimental 
- Maximum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umax_ ⚠relaxed Experimental 
- Maximum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umax_ ⚠release Experimental 
- Maximum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umax_ ⚠seqcst Experimental 
- Maximum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umin_ ⚠acqrel Experimental 
- Minimum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umin_ ⚠acquire Experimental 
- Minimum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umin_ ⚠relaxed Experimental 
- Minimum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umin_ ⚠release Experimental 
- Minimum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_umin_ ⚠seqcst Experimental 
- Minimum with the current value using an unsigned comparison.
Tmust be an unsigned integer type.
- atomic_xadd_ ⚠acqrel Experimental 
- Adds to the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xadd_ ⚠acquire Experimental 
- Adds to the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xadd_ ⚠relaxed Experimental 
- Adds to the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xadd_ ⚠release Experimental 
- Adds to the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xadd_ ⚠seqcst Experimental 
- Adds to the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xchg_ ⚠acqrel Experimental 
- Stores the value at the specified memory location, returning the old value.
Tmust be an integer or pointer type.
- atomic_xchg_ ⚠acquire Experimental 
- Stores the value at the specified memory location, returning the old value.
Tmust be an integer or pointer type.
- atomic_xchg_ ⚠relaxed Experimental 
- Stores the value at the specified memory location, returning the old value.
Tmust be an integer or pointer type.
- atomic_xchg_ ⚠release Experimental 
- Stores the value at the specified memory location, returning the old value.
Tmust be an integer or pointer type.
- atomic_xchg_ ⚠seqcst Experimental 
- Stores the value at the specified memory location, returning the old value.
Tmust be an integer or pointer type.
- atomic_xor_ ⚠acqrel Experimental 
- Bitwise xor with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xor_ ⚠acquire Experimental 
- Bitwise xor with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xor_ ⚠relaxed Experimental 
- Bitwise xor with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xor_ ⚠release Experimental 
- Bitwise xor with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xor_ ⚠seqcst Experimental 
- Bitwise xor with the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xsub_ ⚠acqrel Experimental 
- Subtract from the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xsub_ ⚠acquire Experimental 
- Subtract from the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xsub_ ⚠relaxed Experimental 
- Subtract from the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xsub_ ⚠release Experimental 
- Subtract from the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- atomic_xsub_ ⚠seqcst Experimental 
- Subtract from the current value, returning the previous value.
Tmust be an integer or pointer type. IfTis a pointer type, the provenance ofsrcis ignored: both the return value and the new value stored at*dstwill have the provenance of the old value stored there.
- bitreverseExperimental 
- Reverses the bits in an integer type T.
- black_box Experimental 
- See documentation of std::hint::black_boxfor details.
- breakpointExperimental 
- Executes a breakpoint trap, for inspection by a debugger.
- bswapExperimental 
- Reverses the bytes in an integer type T.
- caller_location Experimental 
- Gets a reference to a static Locationindicating where it was called.
- carrying_mul_ add Experimental 
- Performs full-width multiplication and addition with a carry:
multiplier * multiplicand + addend + carry.
- catch_unwind ⚠Experimental 
- Rust’s “try catch” construct for unwinding. Invokes the function pointer try_fnwith the data pointerdata, and callscatch_fnif unwinding occurs whiletry_fnruns. Returns1if unwinding occurred andcatch_fnwas called; returns0otherwise.
- ceilf16⚠Experimental 
- Returns the smallest integer greater than or equal to an f16.
- ceilf32⚠Experimental 
- Returns the smallest integer greater than or equal to an f32.
- ceilf64⚠Experimental 
- Returns the smallest integer greater than or equal to an f64.
- ceilf128⚠Experimental 
- Returns the smallest integer greater than or equal to an f128.
- cold_path Experimental 
- Hints to the compiler that current code path is cold.
- compare_bytes ⚠Experimental 
- Lexicographically compare [left, left + bytes)and[right, right + bytes)as unsigned bytes, returning negative ifleftis less, zero if all the bytes match, or positive ifleftis greater.
- const_allocate ⚠Experimental 
- Allocates a block of memory at compile time. At runtime, just returns a null pointer.
- const_deallocate ⚠Experimental 
- Deallocates a memory which allocated by intrinsics::const_allocateat compile time. At runtime, does nothing.
- const_eval_ select Experimental 
- Selects which function to call depending on the context.
- contract_check_ ensures Experimental 
- Check if the post-condition condhas been met.
- contract_check_ requires Experimental 
- Check if the pre-condition condhas been met.
- contract_checks Experimental 
- Returns whether we should perform contract-checking at runtime.
- copysignf16⚠Experimental 
- Copies the sign from ytoxforf16values.
- copysignf32⚠Experimental 
- Copies the sign from ytoxforf32values.
- copysignf64⚠Experimental 
- Copies the sign from ytoxforf64values.
- copysignf128⚠Experimental 
- Copies the sign from ytoxforf128values.
- cosf16⚠Experimental 
- Returns the cosine of an f16.
- cosf32⚠Experimental 
- Returns the cosine of an f32.
- cosf64⚠Experimental 
- Returns the cosine of an f64.
- cosf128⚠Experimental 
- Returns the cosine of an f128.
- ctlzExperimental 
- Returns the number of leading unset bits (zeroes) in an integer type T.
- ctlz_nonzero ⚠Experimental 
- Like ctlz, but extra-unsafe as it returnsundefwhen given anxwith value0.
- ctpopExperimental 
- Returns the number of bits set in an integer type T
- cttzExperimental 
- Returns the number of trailing unset bits (zeroes) in an integer type T.
- cttz_nonzero ⚠Experimental 
- Like cttz, but extra-unsafe as it returnsundefwhen given anxwith value0.
- discriminant_value Experimental 
- Returns the value of the discriminant for the variant in ‘v’;
if Thas no discriminant, returns0.
- disjoint_bitor ⚠Experimental 
- Combine two values which have no bits in common.
- exact_div ⚠Experimental 
- Performs an exact division, resulting in undefined behavior where
x % y != 0ory == 0orx == T::MIN && y == -1
- exp2f16⚠Experimental 
- Returns 2 raised to the power of an f16.
- exp2f32⚠Experimental 
- Returns 2 raised to the power of an f32.
- exp2f64⚠Experimental 
- Returns 2 raised to the power of an f64.
- exp2f128⚠Experimental 
- Returns 2 raised to the power of an f128.
- expf16⚠Experimental 
- Returns the exponential of an f16.
- expf32⚠Experimental 
- Returns the exponential of an f32.
- expf64⚠Experimental 
- Returns the exponential of an f64.
- expf128⚠Experimental 
- Returns the exponential of an f128.
- fabsf16⚠Experimental 
- Returns the absolute value of an f16.
- fabsf32⚠Experimental 
- Returns the absolute value of an f32.
- fabsf64⚠Experimental 
- Returns the absolute value of an f64.
- fabsf128⚠Experimental 
- Returns the absolute value of an f128.
- fadd_algebraic Experimental 
- Float addition that allows optimizations based on algebraic rules.
- fadd_fast ⚠Experimental 
- Float addition that allows optimizations based on algebraic rules. May assume inputs are finite.
- fdiv_algebraic Experimental 
- Float division that allows optimizations based on algebraic rules.
- fdiv_fast ⚠Experimental 
- Float division that allows optimizations based on algebraic rules. May assume inputs are finite.
- float_to_ ⚠int_ unchecked Experimental 
- Converts with LLVM’s fptoui/fptosi, which may return undef for values out of range (https://github.com/rust-lang/rust/issues/10184)
- floorf16⚠Experimental 
- Returns the largest integer less than or equal to an f16.
- floorf32⚠Experimental 
- Returns the largest integer less than or equal to an f32.
- floorf64⚠Experimental 
- Returns the largest integer less than or equal to an f64.
- floorf128⚠Experimental 
- Returns the largest integer less than or equal to an f128.
- fmaf16⚠Experimental 
- Returns a * b + cforf16values.
- fmaf32⚠Experimental 
- Returns a * b + cforf32values.
- fmaf64⚠Experimental 
- Returns a * b + cforf64values.
- fmaf128⚠Experimental 
- Returns a * b + cforf128values.
- fmul_algebraic Experimental 
- Float multiplication that allows optimizations based on algebraic rules.
- fmul_fast ⚠Experimental 
- Float multiplication that allows optimizations based on algebraic rules. May assume inputs are finite.
- fmuladdf16⚠Experimental 
- Returns a * b + cforf16values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
- fmuladdf32⚠Experimental 
- Returns a * b + cforf32values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
- fmuladdf64⚠Experimental 
- Returns a * b + cforf64values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
- fmuladdf128⚠Experimental 
- Returns a * b + cforf128values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
- forgetExperimental 
- Moves a value out of scope without running drop glue.
- frem_algebraic Experimental 
- Float remainder that allows optimizations based on algebraic rules.
- frem_fast ⚠Experimental 
- Float remainder that allows optimizations based on algebraic rules. May assume inputs are finite.
- fsub_algebraic Experimental 
- Float subtraction that allows optimizations based on algebraic rules.
- fsub_fast ⚠Experimental 
- Float subtraction that allows optimizations based on algebraic rules. May assume inputs are finite.
- is_val_ statically_ known Experimental 
- Returns whether the argument’s value is statically known at compile-time.
- likelyExperimental 
- Hints to the compiler that branch condition is likely to be true. Returns the value passed to it.
- log2f16⚠Experimental 
- Returns the base 2 logarithm of an f16.
- log2f32⚠Experimental 
- Returns the base 2 logarithm of an f32.
- log2f64⚠Experimental 
- Returns the base 2 logarithm of an f64.
- log2f128⚠Experimental 
- Returns the base 2 logarithm of an f128.
- log10f16⚠Experimental 
- Returns the base 10 logarithm of an f16.
- log10f32⚠Experimental 
- Returns the base 10 logarithm of an f32.
- log10f64⚠Experimental 
- Returns the base 10 logarithm of an f64.
- log10f128⚠Experimental 
- Returns the base 10 logarithm of an f128.
- logf16⚠Experimental 
- Returns the natural logarithm of an f16.
- logf32⚠Experimental 
- Returns the natural logarithm of an f32.
- logf64⚠Experimental 
- Returns the natural logarithm of an f64.
- logf128⚠Experimental 
- Returns the natural logarithm of an f128.
- maxnumf16Experimental 
- Returns the maximum of two f16values.
- maxnumf32Experimental 
- Returns the maximum of two f32values.
- maxnumf64Experimental 
- Returns the maximum of two f64values.
- maxnumf128Experimental 
- Returns the maximum of two f128values.
- min_align_ of Experimental 
- The minimum alignment of a type.
- min_align_ ⚠of_ val Experimental 
- The required alignment of the referenced value.
- minnumf16Experimental 
- Returns the minimum of two f16values.
- minnumf32Experimental 
- Returns the minimum of two f32values.
- minnumf64Experimental 
- Returns the minimum of two f64values.
- minnumf128Experimental 
- Returns the minimum of two f128values.
- mul_with_ overflow Experimental 
- Performs checked integer multiplication
- needs_drop Experimental 
- Returns trueif the actual type given asTrequires drop glue; returnsfalseif the actual type provided forTimplementsCopy.
- nontemporal_store ⚠Experimental 
- Emits a nontemporalstore, which gives a hint to the CPU that the data should not be held in cache. Except for performance, this is fully equivalent toptr.write(val).
- offset⚠Experimental 
- Calculates the offset from a pointer.
- powf16⚠Experimental 
- Raises an f16to anf16power.
- powf32⚠Experimental 
- Raises an f32to anf32power.
- powf64⚠Experimental 
- Raises an f64to anf64power.
- powf128⚠Experimental 
- Raises an f128to anf128power.
- powif16⚠Experimental 
- Raises an f16to an integer power.
- powif32⚠Experimental 
- Raises an f32to an integer power.
- powif64⚠Experimental 
- Raises an f64to an integer power.
- powif128⚠Experimental 
- Raises an f128to an integer power.
- pref_align_ ⚠of Experimental 
- The preferred alignment of a type.
- prefetch_read_ ⚠data Experimental 
- The prefetchintrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
- prefetch_read_ ⚠instruction Experimental 
- The prefetchintrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
- prefetch_write_ ⚠data Experimental 
- The prefetchintrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
- prefetch_write_ ⚠instruction Experimental 
- The prefetchintrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
- ptr_guaranteed_ cmp Experimental 
- See documentation of <*const T>::guaranteed_eqfor details. Returns2if the result is unknown. Returns1if the pointers are guaranteed equal. Returns0if the pointers are guaranteed inequal.
- ptr_mask Experimental 
- Masks out bits of the pointer according to a mask.
- ptr_metadata Experimental 
- Lowers in MIR to Rvalue::UnaryOpwithUnOp::PtrMetadata.
- ptr_offset_ ⚠from Experimental 
- See documentation of <*const T>::offset_fromfor details.
- ptr_offset_ ⚠from_ unsigned Experimental 
- See documentation of <*const T>::sub_ptrfor details.
- raw_eq⚠Experimental 
- Determines whether the raw bytes of the two values are equal.
- read_via_ ⚠copy Experimental 
- This is an implementation detail of crate::ptr::readand should not be used anywhere else. See its comments for why this exists.
- rintf32⚠Experimental 
- Provided for compatibility with stdarch. DO NOT USE.
- rintf64⚠Experimental 
- Provided for compatibility with stdarch. DO NOT USE.
- rotate_left Experimental 
- Performs rotate left.
- rotate_right Experimental 
- Performs rotate right.
- round_ties_ even_ f16 Experimental 
- Returns the nearest integer to an f16. Rounds half-way cases to the number with an even least significant digit.
- round_ties_ even_ f32 Experimental 
- Returns the nearest integer to an f32. Rounds half-way cases to the number with an even least significant digit.
- round_ties_ even_ f64 Experimental 
- Returns the nearest integer to an f64. Rounds half-way cases to the number with an even least significant digit.
- round_ties_ even_ f128 Experimental 
- Returns the nearest integer to an f128. Rounds half-way cases to the number with an even least significant digit.
- roundf16⚠Experimental 
- Returns the nearest integer to an f16. Rounds half-way cases away from zero.
- roundf32⚠Experimental 
- Returns the nearest integer to an f32. Rounds half-way cases away from zero.
- roundf64⚠Experimental 
- Returns the nearest integer to an f64. Rounds half-way cases away from zero.
- roundf128⚠Experimental 
- Returns the nearest integer to an f128. Rounds half-way cases away from zero.
- rustc_peek Experimental 
- Magic intrinsic that derives its meaning from attributes attached to the function.
- saturating_add Experimental 
- Computes a + b, saturating at numeric bounds.
- saturating_sub Experimental 
- Computes a - b, saturating at numeric bounds.
- select_unpredictable Experimental 
- Returns either true_valorfalse_valdepending on conditionbwith a hint to the compiler that this condition is unlikely to be correctly predicted by a CPU’s branch predictor (e.g. a binary search).
- sinf16⚠Experimental 
- Returns the sine of an f16.
- sinf32⚠Experimental 
- Returns the sine of an f32.
- sinf64⚠Experimental 
- Returns the sine of an f64.
- sinf128⚠Experimental 
- Returns the sine of an f128.
- size_ofExperimental 
- The size of a type in bytes.
- size_of_ ⚠val Experimental 
- The size of the referenced value in bytes.
- sqrtf16⚠Experimental 
- Returns the square root of an f16
- sqrtf32⚠Experimental 
- Returns the square root of an f32
- sqrtf64⚠Experimental 
- Returns the square root of an f64
- sqrtf128⚠Experimental 
- Returns the square root of an f128
- sub_with_ overflow Experimental 
- Performs checked integer subtraction
- three_way_ compare Experimental 
- Does a three-way comparison between the two integer arguments.
- transmute_unchecked ⚠Experimental 
- Like transmute, but even less checked at compile-time: rather than giving an error forsize_of::<Src>() != size_of::<Dst>(), it’s Undefined Behavior at runtime.
- truncf16⚠Experimental 
- Returns the integer part of an f16.
- truncf32⚠Experimental 
- Returns the integer part of an f32.
- truncf64⚠Experimental 
- Returns the integer part of an f64.
- truncf128⚠Experimental 
- Returns the integer part of an f128.
- type_idExperimental 
- 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 Experimental 
- Gets a static string slice containing the name of a type.
- typed_swap_ ⚠nonoverlapping Experimental 
- Non-overlapping typed swap of a single value.
- ub_checks Experimental 
- Returns whether we should perform some UB-checking at runtime. This eventually evaluates to
cfg!(ub_checks), but behaves different fromcfg!when mixing crates built with different flags: if the crate has UB checks enabled or carries the#[rustc_preserve_ub_checks]attribute, evaluation is delayed until monomorphization (or until the call gets inlined into a crate that does not delay evaluation further); otherwise it can happen any time.
- unaligned_volatile_ ⚠load Experimental 
- Performs a volatile load from the srcpointer The pointer is not required to be aligned.
- unaligned_volatile_ ⚠store Experimental 
- Performs a volatile store to the dstpointer. The pointer is not required to be aligned.
- unchecked_add ⚠Experimental 
- Returns the result of an unchecked addition, resulting in
undefined behavior when x + y > T::MAXorx + y < T::MIN.
- unchecked_div ⚠Experimental 
- Performs an unchecked division, resulting in undefined behavior
where y == 0orx == T::MIN && y == -1
- unchecked_mul ⚠Experimental 
- Returns the result of an unchecked multiplication, resulting in
undefined behavior when x * y > T::MAXorx * y < T::MIN.
- unchecked_rem ⚠Experimental 
- Returns the remainder of an unchecked division, resulting in
undefined behavior when y == 0orx == T::MIN && y == -1
- unchecked_shl ⚠Experimental 
- Performs an unchecked left shift, resulting in undefined behavior when
y < 0ory >= N, where N is the width of T in bits.
- unchecked_shr ⚠Experimental 
- Performs an unchecked right shift, resulting in undefined behavior when
y < 0ory >= N, where N is the width of T in bits.
- unchecked_sub ⚠Experimental 
- Returns the result of an unchecked subtraction, resulting in
undefined behavior when x - y > T::MAXorx - y < T::MIN.
- unlikelyExperimental 
- Hints to the compiler that branch condition is likely to be false. Returns the value passed to it.
- unreachable⚠Experimental 
- Informs the optimizer that this point in the code is not reachable, enabling further optimizations.
- variant_count Experimental 
- Returns the number of variants of the type Tcast to ausize; ifThas no variants, returns0. Uninhabited variants will be counted.
- volatile_copy_ ⚠memory Experimental 
- Equivalent to the appropriate llvm.memmove.p0i8.0i8.*intrinsic, with a size ofcount * size_of::<T>()and an alignment ofmin_align_of::<T>()
- volatile_copy_ ⚠nonoverlapping_ memory Experimental 
- Equivalent to the appropriate llvm.memcpy.p0i8.0i8.*intrinsic, with a size ofcount*size_of::<T>()and an alignment ofmin_align_of::<T>()
- volatile_load ⚠Experimental 
- Performs a volatile load from the srcpointer.
- volatile_set_ ⚠memory Experimental 
- Equivalent to the appropriate llvm.memset.p0i8.*intrinsic, with a size ofcount * size_of::<T>()and an alignment ofmin_align_of::<T>().
- volatile_store ⚠Experimental 
- Performs a volatile store to the dstpointer.
- vtable_align ⚠Experimental 
- The intrinsic will return the alignment stored in that vtable.
- vtable_size ⚠Experimental 
- The intrinsic will return the size stored in that vtable.
- wrapping_add Experimental 
- Returns (a + b) mod 2N, where N is the width of T in bits.
- wrapping_mul Experimental 
- Returns (a * b) mod 2N, where N is the width of T in bits.
- wrapping_sub Experimental 
- Returns (a - b) mod 2N, where N is the width of T in bits.
- write_via_ ⚠move Experimental 
- This is an implementation detail of crate::ptr::writeand should not be used anywhere else. See its comments for why this exists.