From 06a6bde602f15f4710915895e58a3d35858c39b0 Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Mon, 4 Mar 2024 20:34:29 -0500 Subject: [PATCH] Document const-ness of `transmute(_*)!` macros (#1019) --- src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9f1c665865..2777903294 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4332,6 +4332,10 @@ mod simd { /// /// assert_eq!(two_dimensional, [[0, 1, 2, 3], [4, 5, 6, 7]]); /// ``` +/// +/// # Use in `const` contexts +/// +/// This macro can be invoked in `const` contexts. #[macro_export] macro_rules! transmute { ($e:expr) => {{ @@ -4400,6 +4404,10 @@ macro_rules! transmute { /// assert_eq!(two_dimensional, &[[0, 1, 2, 3], [4, 5, 6, 7]]); /// ``` /// +/// # Use in `const` contexts +/// +/// This macro can be invoked in `const` contexts. +/// /// # Alignment increase error message /// /// Because of limitations on macros, the error message generated when @@ -4530,6 +4538,10 @@ macro_rules! transmute_ref { /// assert_eq!(one_dimensional, [4, 5, 6, 7, 0, 1, 2, 3]); /// ``` /// +/// # Use in `const` contexts +/// +/// This macro can be invoked in `const` contexts. +/// /// # Alignment increase error message /// /// Because of limitations on macros, the error message generated when @@ -4691,6 +4703,10 @@ macro_rules! transmute_mut { /// assert_eq!(as_i32, i32::from_ne_bytes([b'a', b'b', b'c', b'd'])); /// } /// ``` +/// +/// # Use in `const` contexts +/// +/// This macro can be invoked in `const` contexts. #[doc(alias("include_bytes", "include_data", "include_type"))] #[macro_export] macro_rules! include_value {