From 8372b50a6faa2883a6bd15fde121fcb47e6d43e9 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Thu, 18 Jun 2026 15:53:52 +0200 Subject: [PATCH] feat: add macro to declare unstable constants This patch adds a new macro that can be used for declaring constants when these are known to possibly change upstream across target OS/ABI versions. --- src/macros.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/macros.rs b/src/macros.rs index 0149b1fd18466..5c5b8c2deac79 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -402,6 +402,21 @@ macro_rules! offset_of { }}; } +/// Defines constants with an accompanying doc comment pointing out their +/// instability, and links to the crate documentation for usage guidelines. +macro_rules! ct { + ($($it:item)+) => { +$( +/// This constant, among others often used in C for the purposes of denoting the +/// latest value or limit in a set of constants, is likely to change upstream. +/// For correct usage, see the [crate-level documentation][docs]. +/// +/// [docs]: index.html#usage-recommendations +$it +)+ + }; +} + #[cfg(test)] mod tests { use core::any::TypeId;