Skip to main content

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"]
13#[ferrocene::annotation(
14    "This function cannot be covered as it is never called at runtime, see documentation"
15)]
16#[ferrocene::prevalidated]
17pub fn compiler_move<T, const SIZE: usize>(_src: *const T, _dst: *mut T) {
18    unreachable!(
19        "compiler_move marks where the compiler-generated a memcpy for moves. It is never actually called."
20    )
21}
22
23/// Profiling marker for copy operations.
24///
25/// This function is never called at runtime. When `-Z annotate-moves` is enabled,
26/// the compiler creates synthetic debug info that makes copy operations appear as
27/// calls to this function in profilers.
28///
29/// The `SIZE` parameter encodes the size of the type being copied. It's the same as
30/// `size_of::<T>()`, and is only present for convenience.
31#[unstable(feature = "profiling_marker_api", issue = "148197")]
32#[lang = "compiler_copy"]
33#[ferrocene::annotation(
34    "This function cannot be covered as it is never called at runtime, see documentation"
35)]
36#[ferrocene::prevalidated]
37pub fn compiler_copy<T, const SIZE: usize>(_src: *const T, _dst: *mut T) {
38    unreachable!(
39        "compiler_copy marks where the compiler-generated a memcpy for Copies. It is never actually called."
40    )
41}