core/os/windows.rs
1//! Platform-specific extensions to `core` for Windows platforms.
2
3#![unstable(feature = "codeview_annotation", issue = "163964")]
4#![doc(cfg(windows))]
5
6#[doc(inline)]
7pub use crate::intrinsics::CodeViewAnnotationArgs;
8
9/// Writes [`T::ARGS`](CodeViewAnnotationArgs::ARGS) to the PDB as an `S_ANNOTATION` record using
10/// [`llvm.codeview.annotation`](https://llvm.org/docs/LangRef.html#llvm-codeview-annotation-intrinsic).
11///
12/// This function has an effect only on the `msvc` environment and the LLVM backend. It is a no-op on other
13/// environments and backends.
14///
15/// # Examples
16///
17/// To call `codeview_annotation`, the caller must declare a type
18/// implementing [`CodeViewAnnotationArgs`] and pass it as the type
19/// parameter to `codeview_annotation`. The string arguments must be
20/// specified in `CodeViewAnnotationArgs::ARGS`.
21///
22#[cfg_attr(windows, doc = "```")]
23#[cfg_attr(not(windows), doc = "```ignore (needs windows)")]
24/// #![feature(codeview_annotation, core_os)]
25/// use core::os::windows::{codeview_annotation, CodeViewAnnotationArgs};
26///
27/// struct Args;
28///
29/// impl CodeViewAnnotationArgs for Args {
30/// const ARGS: &[&str] = &["Hello", "World"];
31/// }
32///
33/// codeview_annotation::<Args>();
34/// ```
35#[inline(always)]
36#[unstable(feature = "codeview_annotation", issue = "163964")]
37pub fn codeview_annotation<T: CodeViewAnnotationArgs>() {
38 crate::intrinsics::codeview_annotation::<T>();
39}