Module intrinsics

Module intrinsics 

Source
🔬This is a nightly-only experimental API. (core_intrinsics)
Expand description

Compiler intrinsics.

The functions in this module are implementation details of core and should not be used outside of the standard library. We generally provide access to intrinsics via stable wrapper functions. Use these instead.

These are the imports making intrinsics available to Rust code. The actual implementations live in the compiler. Some of these intrinsics are lowered to MIR in https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_transform/src/lower_intrinsics.rs. The remaining intrinsics are implemented for the LLVM backend in https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs and https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs, and for const evaluation in https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs.

§Const intrinsics

In order to make an intrinsic unstable usable at compile-time, 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 below a const fn. This should be done in coordination with wg-const-eval.

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 read_volatile and write_volatile.

§Atomics

The atomic intrinsics provide common atomic operations on machine words, with multiple possible memory orderings. See the atomic types docs for details.

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

fallbackExperimentalNon-ferrocene_certified
mirExperimentalNon-ferrocene_certified
Rustc internal tooling for hand-writing MIR.
simdExperimentalNon-ferrocene_certified
SIMD compiler intrinsics.

Enums§

AtomicOrderingExperimental
A type for atomic ordering parameters for intrinsics. This is a separate type from atomic::Ordering so that we can make it ConstParamTy and fix the values used here without a risk of leaking that to stable code.

Functions§

copyDeprecatedNon-ferrocene_certified
This is an accidentally-stable alias to ptr::copy; use that instead.
copy_nonoverlappingDeprecatedNon-ferrocene_certified
This is an accidentally-stable alias to ptr::copy_nonoverlapping; use that instead.
transmuteDeprecated
Reinterprets the bits of a value of one type as another type.
write_bytesDeprecatedNon-ferrocene_certified
This is an accidentally-stable alias to ptr::write_bytes; use that instead.
abortExperimental
Aborts the execution of the process.
add_with_overflowExperimentalNon-ferrocene_certified
Performs checked integer addition.
aggregate_raw_ptrExperimental
Lowers in MIR to Rvalue::Aggregate with AggregateKind::RawPtr.
align_ofExperimental
The minimum alignment of a type.
align_of_valExperimentalNon-ferrocene_certified
The required alignment of the referenced value.
arith_offsetExperimentalNon-ferrocene_certified
Calculates the offset from a pointer, potentially wrapping.
assert_inhabitedExperimentalNon-ferrocene_certified
A guard for unsafe functions that cannot ever be executed if T is uninhabited: This will statically either panic, or do nothing. It does not guarantee to ever panic, and should only be called if an assertion failure will imply language UB in the following code.
assert_mem_uninitialized_validExperimentalNon-ferrocene_certified
A guard for std::mem::uninitialized. This will statically either panic, or do nothing. It does not guarantee to ever panic, and should only be called if an assertion failure will imply language UB in the following code.
assert_zero_validExperimentalNon-ferrocene_certified
A guard for unsafe functions that cannot ever be executed if T does not permit zero-initialization: This will statically either panic, or do nothing. It does not guarantee to ever panic, and should only be called if an assertion failure will imply language UB in the following code.
assumeExperimentalNon-ferrocene_certified
Informs the optimizer that a condition is always true. If the condition is false, the behavior is undefined.
atomic_andExperimental
Bitwise and with the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
atomic_cxchgExperimental
Stores a value if the current value is the same as the old value. T must be an integer or pointer type.
atomic_cxchgweakExperimental
Stores a value if the current value is the same as the old value. T must be an integer or pointer type. The comparison may spuriously fail.
atomic_fenceExperimentalNon-ferrocene_certified
An atomic fence.
atomic_loadExperimental
Loads the current value of the pointer. T must be an integer or pointer type.
atomic_maxExperimentalNon-ferrocene_certified
Maximum with the current value using a signed comparison. T must be a signed integer type.
atomic_minExperimentalNon-ferrocene_certified
Minimum with the current value using a signed comparison. T must be a signed integer type.
atomic_nandExperimental
Bitwise nand with the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
atomic_orExperimental
Bitwise or with the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
atomic_singlethreadfenceExperimentalNon-ferrocene_certified
An atomic fence for synchronization within a single thread.
atomic_storeExperimental
Stores the value at the specified memory location. T must be an integer or pointer type.
atomic_umaxExperimental
Maximum with the current value using an unsigned comparison. T must be an unsigned integer type.
atomic_uminExperimental
Minimum with the current value using an unsigned comparison. T must be an unsigned integer type.
atomic_xaddExperimental
Adds to the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
atomic_xchgExperimental
Stores the value at the specified memory location, returning the old value. T must be an integer or pointer type.
atomic_xorExperimental
Bitwise xor with the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
atomic_xsubExperimental
Subtract from the current value, returning the previous value. T must be an integer or pointer type. U must be the same as T if that is an integer type, or usize if T is a pointer type.
autodiffExperimental
Generates the LLVM body for the automatic differentiation of f using Enzyme, with df as the derivative function and args as its arguments.
bitreverseExperimentalNon-ferrocene_certified
Reverses the bits in an integer type T.
black_boxExperimentalNon-ferrocene_certified
See documentation of std::hint::black_box for details.
breakpointExperimentalNon-ferrocene_certified
Executes a breakpoint trap, for inspection by a debugger.
bswapExperimentalNon-ferrocene_certified
Reverses the bytes in an integer type T.
caller_locationExperimentalNon-ferrocene_certified
Gets a reference to a static Location indicating where it was called.
carrying_mul_addExperimentalNon-ferrocene_certified
Performs full-width multiplication and addition with a carry: multiplier * multiplicand + addend + carry.
catch_unwindExperimentalNon-ferrocene_certified
Rust’s “try catch” construct for unwinding. Invokes the function pointer try_fn with the data pointer data, and calls catch_fn if unwinding occurs while try_fn runs. Returns 1 if unwinding occurred and catch_fn was called; returns 0 otherwise.
ceilf16ExperimentalNon-ferrocene_certified
Returns the smallest integer greater than or equal to an f16.
ceilf32ExperimentalNon-ferrocene_certified
Returns the smallest integer greater than or equal to an f32.
ceilf64ExperimentalNon-ferrocene_certified
Returns the smallest integer greater than or equal to an f64.
ceilf128ExperimentalNon-ferrocene_certified
Returns the smallest integer greater than or equal to an f128.
cold_pathExperimentalNon-ferrocene_certified
Hints to the compiler that current code path is cold.
compare_bytesExperimentalNon-ferrocene_certified
Lexicographically compare [left, left + bytes) and [right, right + bytes) as unsigned bytes, returning negative if left is less, zero if all the bytes match, or positive if left is greater.
const_allocateExperimentalNon-ferrocene_certified
Allocates a block of memory at compile time. At runtime, just returns a null pointer.
const_deallocateExperimentalNon-ferrocene_certified
Deallocates a memory which allocated by intrinsics::const_allocate at compile time. At runtime, does nothing.
const_eval_selectExperimental
Selects which function to call depending on the context.
const_make_globalExperimental
contract_check_ensuresExperimentalNon-ferrocene_certified
Check if the post-condition cond has been met.
contract_check_requiresExperimentalNon-ferrocene_certified
Check if the pre-condition cond has been met.
contract_checksExperimentalNon-ferrocene_certified
Returns whether we should perform contract-checking at runtime.
copysignf16ExperimentalNon-ferrocene_certified
Copies the sign from y to x for f16 values.
copysignf32ExperimentalNon-ferrocene_certified
Copies the sign from y to x for f32 values.
copysignf64ExperimentalNon-ferrocene_certified
Copies the sign from y to x for f64 values.
copysignf128ExperimentalNon-ferrocene_certified
Copies the sign from y to x for f128 values.
cosf16ExperimentalNon-ferrocene_certified
Returns the cosine of an f16.
cosf32ExperimentalNon-ferrocene_certified
Returns the cosine of an f32.
cosf64ExperimentalNon-ferrocene_certified
Returns the cosine of an f64.
cosf128ExperimentalNon-ferrocene_certified
Returns the cosine of an f128.
ctlzExperimentalNon-ferrocene_certified
Returns the number of leading unset bits (zeroes) in an integer type T.
ctlz_nonzeroExperimentalNon-ferrocene_certified
Like ctlz, but extra-unsafe as it returns undef when given an x with value 0.
ctpopExperimental
Returns the number of bits set in an integer type T
cttzExperimentalNon-ferrocene_certified
Returns the number of trailing unset bits (zeroes) in an integer type T.
cttz_nonzeroExperimentalNon-ferrocene_certified
Like cttz, but extra-unsafe as it returns undef when given an x with value 0.
discriminant_valueExperimental
Returns the value of the discriminant for the variant in ‘v’; if T has no discriminant, returns 0.
disjoint_bitorExperimentalNon-ferrocene_certified
Combine two values which have no bits in common.
exact_divExperimentalNon-ferrocene_certified
Performs an exact division, resulting in undefined behavior where x % y != 0 or y == 0 or x == T::MIN && y == -1
exp2f16ExperimentalNon-ferrocene_certified
Returns 2 raised to the power of an f16.
exp2f32ExperimentalNon-ferrocene_certified
Returns 2 raised to the power of an f32.
exp2f64ExperimentalNon-ferrocene_certified
Returns 2 raised to the power of an f64.
exp2f128ExperimentalNon-ferrocene_certified
Returns 2 raised to the power of an f128.
expf16ExperimentalNon-ferrocene_certified
Returns the exponential of an f16.
expf32ExperimentalNon-ferrocene_certified
Returns the exponential of an f32.
expf64ExperimentalNon-ferrocene_certified
Returns the exponential of an f64.
expf128ExperimentalNon-ferrocene_certified
Returns the exponential of an f128.
fabsf16ExperimentalNon-ferrocene_certified
Returns the absolute value of an f16.
fabsf32ExperimentalNon-ferrocene_certified
Returns the absolute value of an f32.
fabsf64ExperimentalNon-ferrocene_certified
Returns the absolute value of an f64.
fabsf128ExperimentalNon-ferrocene_certified
Returns the absolute value of an f128.
fadd_algebraicExperimentalNon-ferrocene_certified
Float addition that allows optimizations based on algebraic rules.
fadd_fastExperimentalNon-ferrocene_certified
Float addition that allows optimizations based on algebraic rules. Requires that inputs and output of the operation are finite, causing UB otherwise.
fdiv_algebraicExperimentalNon-ferrocene_certified
Float division that allows optimizations based on algebraic rules.
fdiv_fastExperimentalNon-ferrocene_certified
Float division that allows optimizations based on algebraic rules. Requires that inputs and output of the operation are finite, causing UB otherwise.
float_to_int_uncheckedExperimentalNon-ferrocene_certified
Converts with LLVM’s fptoui/fptosi, which may return undef for values out of range (https://github.com/rust-lang/rust/issues/10184)
floorf16ExperimentalNon-ferrocene_certified
Returns the largest integer less than or equal to an f16.
floorf32ExperimentalNon-ferrocene_certified
Returns the largest integer less than or equal to an f32.
floorf64ExperimentalNon-ferrocene_certified
Returns the largest integer less than or equal to an f64.
floorf128ExperimentalNon-ferrocene_certified
Returns the largest integer less than or equal to an f128.
fmaf16ExperimentalNon-ferrocene_certified
Returns a * b + c for f16 values.
fmaf32ExperimentalNon-ferrocene_certified
Returns a * b + c for f32 values.
fmaf64ExperimentalNon-ferrocene_certified
Returns a * b + c for f64 values.
fmaf128ExperimentalNon-ferrocene_certified
Returns a * b + c for f128 values.
fmul_algebraicExperimentalNon-ferrocene_certified
Float multiplication that allows optimizations based on algebraic rules.
fmul_fastExperimentalNon-ferrocene_certified
Float multiplication that allows optimizations based on algebraic rules. Requires that inputs and output of the operation are finite, causing UB otherwise.
fmuladdf16ExperimentalNon-ferrocene_certified
Returns a * b + c for f16 values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
fmuladdf32ExperimentalNon-ferrocene_certified
Returns a * b + c for f32 values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
fmuladdf64ExperimentalNon-ferrocene_certified
Returns a * b + c for f64 values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
fmuladdf128ExperimentalNon-ferrocene_certified
Returns a * b + c for f128 values, non-deterministically executing either a fused multiply-add or two operations with rounding of the intermediate result.
forgetExperimentalNon-ferrocene_certified
Moves a value out of scope without running drop glue.
frem_algebraicExperimentalNon-ferrocene_certified
Float remainder that allows optimizations based on algebraic rules.
frem_fastExperimentalNon-ferrocene_certified
Float remainder that allows optimizations based on algebraic rules. Requires that inputs and output of the operation are finite, causing UB otherwise.
fsub_algebraicExperimentalNon-ferrocene_certified
Float subtraction that allows optimizations based on algebraic rules.
fsub_fastExperimentalNon-ferrocene_certified
Float subtraction that allows optimizations based on algebraic rules. Requires that inputs and output of the operation are finite, causing UB otherwise.
is_val_statically_knownExperimentalNon-ferrocene_certified
Returns whether the argument’s value is statically known at compile-time.
likelyExperimentalNon-ferrocene_certified
Hints to the compiler that branch condition is likely to be true. Returns the value passed to it.
log2f16ExperimentalNon-ferrocene_certified
Returns the base 2 logarithm of an f16.
log2f32ExperimentalNon-ferrocene_certified
Returns the base 2 logarithm of an f32.
log2f64ExperimentalNon-ferrocene_certified
Returns the base 2 logarithm of an f64.
log2f128ExperimentalNon-ferrocene_certified
Returns the base 2 logarithm of an f128.
log10f16ExperimentalNon-ferrocene_certified
Returns the base 10 logarithm of an f16.
log10f32ExperimentalNon-ferrocene_certified
Returns the base 10 logarithm of an f32.
log10f64ExperimentalNon-ferrocene_certified
Returns the base 10 logarithm of an f64.
log10f128ExperimentalNon-ferrocene_certified
Returns the base 10 logarithm of an f128.
logf16ExperimentalNon-ferrocene_certified
Returns the natural logarithm of an f16.
logf32ExperimentalNon-ferrocene_certified
Returns the natural logarithm of an f32.
logf64ExperimentalNon-ferrocene_certified
Returns the natural logarithm of an f64.
logf128ExperimentalNon-ferrocene_certified
Returns the natural logarithm of an f128.
maximumf16ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2019 maximum) of two f16 values.
maximumf32ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2019 maximum) of two f32 values.
maximumf64ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2019 maximum) of two f64 values.
maximumf128ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2019 maximum) of two f128 values.
maxnumf16ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2008 maxNum) of two f16 values.
maxnumf32ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2008 maxNum) of two f32 values.
maxnumf64ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2008 maxNum) of two f64 values.
maxnumf128ExperimentalNon-ferrocene_certified
Returns the maximum (IEEE 754-2008 maxNum) of two f128 values.
minimumf16ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2019 minimum) of two f16 values.
minimumf32ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2019 minimum) of two f32 values.
minimumf64ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2019 minimum) of two f64 values.
minimumf128ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2019 minimum) of two f128 values.
minnumf16ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2008 minNum) of two f16 values.
minnumf32ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2008 minNum) of two f32 values.
minnumf64ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2008 minNum) of two f64 values.
minnumf128ExperimentalNon-ferrocene_certified
Returns the minimum (IEEE 754-2008 minNum) of two f128 values.
mul_with_overflowExperimentalNon-ferrocene_certified
Performs checked integer multiplication
needs_dropExperimentalNon-ferrocene_certified
Returns true if the actual type given as T requires drop glue; returns false if the actual type provided for T implements Copy.
nontemporal_storeExperimentalNon-ferrocene_certified
Emits a nontemporal store, which gives a hint to the CPU that the data should not be held in cache. Except for performance, this is fully equivalent to ptr.write(val).
offsetExperimentalNon-ferrocene_certified
Calculates the offset from a pointer.
powf16ExperimentalNon-ferrocene_certified
Raises an f16 to an f16 power.
powf32ExperimentalNon-ferrocene_certified
Raises an f32 to an f32 power.
powf64ExperimentalNon-ferrocene_certified
Raises an f64 to an f64 power.
powf128ExperimentalNon-ferrocene_certified
Raises an f128 to an f128 power.
powif16ExperimentalNon-ferrocene_certified
Raises an f16 to an integer power.
powif32ExperimentalNon-ferrocene_certified
Raises an f32 to an integer power.
powif64ExperimentalNon-ferrocene_certified
Raises an f64 to an integer power.
powif128ExperimentalNon-ferrocene_certified
Raises an f128 to an integer power.
prefetch_read_dataExperimentalNon-ferrocene_certified
The prefetch intrinsic is a hint to the code generator to insert a prefetch instruction for the given address 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_instructionExperimentalNon-ferrocene_certified
The prefetch intrinsic is a hint to the code generator to insert a prefetch instruction for the given address 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_dataExperimentalNon-ferrocene_certified
The prefetch intrinsic is a hint to the code generator to insert a prefetch instruction for the given address 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_instructionExperimentalNon-ferrocene_certified
The prefetch intrinsic is a hint to the code generator to insert a prefetch instruction for the given address 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_cmpExperimental
See documentation of <*const T>::guaranteed_eq for details. Returns 2 if the result is unknown. Returns 1 if the pointers are guaranteed equal. Returns 0 if the pointers are guaranteed inequal.
ptr_maskExperimentalNon-ferrocene_certified
Masks out bits of the pointer according to a mask.
ptr_metadataExperimentalNon-ferrocene_certified
Lowers in MIR to Rvalue::UnaryOp with UnOp::PtrMetadata.
ptr_offset_fromExperimentalNon-ferrocene_certified
See documentation of <*const T>::offset_from for details.
ptr_offset_from_unsignedExperimentalNon-ferrocene_certified
See documentation of <*const T>::offset_from_unsigned for details.
raw_eqExperimentalNon-ferrocene_certified
Determines whether the raw bytes of the two values are equal.
read_via_copyExperimental
This is an implementation detail of crate::ptr::read and should not be used anywhere else. See its comments for why this exists.
rotate_leftExperimentalNon-ferrocene_certified
Performs rotate left.
rotate_rightExperimentalNon-ferrocene_certified
Performs rotate right.
round_ties_even_f16ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f16. Rounds half-way cases to the number with an even least significant digit.
round_ties_even_f32ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f32. Rounds half-way cases to the number with an even least significant digit.
round_ties_even_f64ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f64. Rounds half-way cases to the number with an even least significant digit.
round_ties_even_f128ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f128. Rounds half-way cases to the number with an even least significant digit.
roundf16ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f16. Rounds half-way cases away from zero.
roundf32ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f32. Rounds half-way cases away from zero.
roundf64ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f64. Rounds half-way cases away from zero.
roundf128ExperimentalNon-ferrocene_certified
Returns the nearest integer to an f128. Rounds half-way cases away from zero.
rustc_peekExperimentalNon-ferrocene_certified
Magic intrinsic that derives its meaning from attributes attached to the function.
saturating_addExperimentalNon-ferrocene_certified
Computes a + b, saturating at numeric bounds.
saturating_subExperimentalNon-ferrocene_certified
Computes a - b, saturating at numeric bounds.
select_unpredictableExperimentalNon-ferrocene_certified
Returns either true_val or false_val depending on condition b with 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).
sinf16ExperimentalNon-ferrocene_certified
Returns the sine of an f16.
sinf32ExperimentalNon-ferrocene_certified
Returns the sine of an f32.
sinf64ExperimentalNon-ferrocene_certified
Returns the sine of an f64.
sinf128ExperimentalNon-ferrocene_certified
Returns the sine of an f128.
size_ofExperimental
The size of a type in bytes.
size_of_valExperimentalNon-ferrocene_certified
The size of the referenced value in bytes.
slice_get_uncheckedExperimentalNon-ferrocene_certified
Projects to the index-th element of slice_ptr, as the same kind of pointer as the slice was provided – so &mut [T] → &mut T, &[T] → &T, *mut [T] → *mut T, or *const [T] → *const T – without a bounds check.
sqrtf16ExperimentalNon-ferrocene_certified
Returns the square root of an f16
sqrtf32ExperimentalNon-ferrocene_certified
Returns the square root of an f32
sqrtf64ExperimentalNon-ferrocene_certified
Returns the square root of an f64
sqrtf128ExperimentalNon-ferrocene_certified
Returns the square root of an f128
sub_with_overflowExperimentalNon-ferrocene_certified
Performs checked integer subtraction
three_way_compareExperimental
Does a three-way comparison between the two arguments, which must be of character or integer (signed or unsigned) type.
transmute_uncheckedExperimentalNon-ferrocene_certified
Like transmute, but even less checked at compile-time: rather than giving an error for size_of::<Src>() != size_of::<Dst>(), it’s Undefined Behavior at runtime.
truncf16ExperimentalNon-ferrocene_certified
Returns the integer part of an f16.
truncf32ExperimentalNon-ferrocene_certified
Returns the integer part of an f32.
truncf64ExperimentalNon-ferrocene_certified
Returns the integer part of an f64.
truncf128ExperimentalNon-ferrocene_certified
Returns the integer part of an f128.
type_idExperimentalNon-ferrocene_certified
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_id_eqExperimentalNon-ferrocene_certified
Tests (at compile-time) if two crate::any::TypeId instances identify the same type. This is necessary because at const-eval time the actual discriminating data is opaque and cannot be inspected directly.
type_nameExperimentalNon-ferrocene_certified
Gets a static string slice containing the name of a type.
typed_swap_nonoverlappingExperimentalNon-ferrocene_certified
Non-overlapping typed swap of a single value.
ub_checksExperimental
Returns whether we should perform some UB-checking at runtime. This eventually evaluates to cfg!(ub_checks), but behaves different from cfg! 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_loadExperimentalNon-ferrocene_certified
Performs a volatile load from the src pointer The pointer is not required to be aligned.
unaligned_volatile_storeExperimentalNon-ferrocene_certified
Performs a volatile store to the dst pointer. The pointer is not required to be aligned.
unchecked_addExperimentalNon-ferrocene_certified
Returns the result of an unchecked addition, resulting in undefined behavior when x + y > T::MAX or x + y < T::MIN.
unchecked_divExperimentalNon-ferrocene_certified
Performs an unchecked division, resulting in undefined behavior where y == 0 or x == T::MIN && y == -1
unchecked_funnel_shlExperimentalNon-ferrocene_certified
Funnel Shift left.
unchecked_funnel_shrExperimentalNon-ferrocene_certified
Funnel Shift right.
unchecked_mulExperimentalNon-ferrocene_certified
Returns the result of an unchecked multiplication, resulting in undefined behavior when x * y > T::MAX or x * y < T::MIN.
unchecked_remExperimentalNon-ferrocene_certified
Returns the remainder of an unchecked division, resulting in undefined behavior when y == 0 or x == T::MIN && y == -1
unchecked_shlExperimentalNon-ferrocene_certified
Performs an unchecked left shift, resulting in undefined behavior when y < 0 or y >= N, where N is the width of T in bits.
unchecked_shrExperimentalNon-ferrocene_certified
Performs an unchecked right shift, resulting in undefined behavior when y < 0 or y >= N, where N is the width of T in bits.
unchecked_subExperimental
Returns the result of an unchecked subtraction, resulting in undefined behavior when x - y > T::MAX or x - y < T::MIN.
unlikelyExperimentalNon-ferrocene_certified
Hints to the compiler that branch condition is likely to be false. Returns the value passed to it.
unreachableExperimental
Informs the optimizer that this point in the code is not reachable, enabling further optimizations.
va_argExperimentalNon-ferrocene_certified
Loads an argument of type T from the va_list ap and increment the argument ap points to.
va_copyExperimentalNon-ferrocene_certified
Copies the current location of arglist src to the arglist dst.
va_endExperimentalNon-ferrocene_certified
Destroy the arglist ap after initialization with va_start or va_copy.
variant_countExperimentalNon-ferrocene_certified
Returns the number of variants of the type T cast to a usize; if T has no variants, returns 0. Uninhabited variants will be counted.
volatile_copy_memoryExperimentalNon-ferrocene_certified
Equivalent to the appropriate llvm.memmove.p0i8.0i8.* intrinsic, with a size of count * size_of::<T>() and an alignment of align_of::<T>().
volatile_copy_nonoverlapping_memoryExperimentalNon-ferrocene_certified
Equivalent to the appropriate llvm.memcpy.p0i8.0i8.* intrinsic, with a size of count * size_of::<T>() and an alignment of align_of::<T>().
volatile_loadExperimentalNon-ferrocene_certified
Performs a volatile load from the src pointer.
volatile_set_memoryExperimentalNon-ferrocene_certified
Equivalent to the appropriate llvm.memset.p0i8.* intrinsic, with a size of count * size_of::<T>() and an alignment of align_of::<T>().
volatile_storeExperimentalNon-ferrocene_certified
Performs a volatile store to the dst pointer.
vtable_alignExperimentalNon-ferrocene_certified
The intrinsic will return the alignment stored in that vtable.
vtable_sizeExperimentalNon-ferrocene_certified
The intrinsic will return the size stored in that vtable.
wrapping_addExperimentalNon-ferrocene_certified
Returns (a + b) mod 2N, where N is the width of T in bits.
wrapping_mulExperimentalNon-ferrocene_certified
Returns (a * b) mod 2N, where N is the width of T in bits.
wrapping_subExperimentalNon-ferrocene_certified
Returns (a - b) mod 2N, where N is the width of T in bits.
write_via_moveExperimental
This is an implementation detail of crate::ptr::write and should not be used anywhere else. See its comments for why this exists.