Skip to content

Commit 8372b50

Browse files
committed
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.
1 parent 1a9bdc4 commit 8372b50

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/macros.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,21 @@ macro_rules! offset_of {
402402
}};
403403
}
404404

405+
/// Defines constants with an accompanying doc comment pointing out their
406+
/// instability, and links to the crate documentation for usage guidelines.
407+
macro_rules! ct {
408+
($($it:item)+) => {
409+
$(
410+
/// This constant, among others often used in C for the purposes of denoting the
411+
/// latest value or limit in a set of constants, is likely to change upstream.
412+
/// For correct usage, see the [crate-level documentation][docs].
413+
///
414+
/// [docs]: index.html#usage-recommendations
415+
$it
416+
)+
417+
};
418+
}
419+
405420
#[cfg(test)]
406421
mod tests {
407422
use core::any::TypeId;

0 commit comments

Comments
 (0)