core/
profiling.rs

1//! Profiling markers for compiler instrumentation.
2
3/// Profiling marker for move operations.
4///
5/// This function is never called at runtime. When `-Z annotate-moves` is enabled,
6/// the compiler creates synthetic debug info that makes move operations appear as
7/// calls to this function in profilers.
8///
9/// The `SIZE` parameter encodes the size of the type being copied. It's the same as
10/// `size_of::<T>()`, and is only present for convenience.
11#[unstable(feature = "profiling_marker_api", issue = "148197")]
12#[lang = "compiler_move"]
13pub fn compiler_move<T, const SIZE: usize>(_src: *const T, _dst: *mut T) {
14    unreachable!(
15        "compiler_move marks where the compiler-generated a memcpy for moves. It is never actually called."
16    )
17}
18
19/// Profiling marker for copy operations.
20///
21/// This function is never called at runtime. When `-Z annotate-moves` is enabled,
22/// the compiler creates synthetic debug info that makes copy operations appear as
23/// calls to this function in profilers.
24///
25/// The `SIZE` parameter encodes the size of the type being copied. It's the same as
26/// `size_of::<T>()`, and is only present for convenience.
27#[unstable(feature = "profiling_marker_api", issue = "148197")]
28#[lang = "compiler_copy"]
29pub fn compiler_copy<T, const SIZE: usize>(_src: *const T, _dst: *mut T) {
30    unreachable!(
31        "compiler_copy marks where the compiler-generated a memcpy for Copies. It is never actually called."
32    )
33}