Skip to content

Commit 6ea0ba5

Browse files
authored
Merge pull request #22 from cuviper/const-doc
Link `const` docs to the standard library
2 parents 8023524 + d3f254f commit 6ea0ba5

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "num-primitive"
3-
version = "0.3.5"
3+
version = "0.3.6"
44
description = "Traits for primitive numeric types"
55
repository = "https://github.com/rust-num/num-primitive"
66
license = "MIT OR Apache-2.0"

RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Release 0.3.6 (2026-01-26)
2+
3+
- Link `const` documentation to the standard library.
4+
15
# Release 0.3.5 (2026-01-22)
26

37
- Updated to MSRV 1.93.

src/macros.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,22 @@ macro_rules! forward_doc {
4646

4747
/// Declare a `const` that copies an original value
4848
macro_rules! use_consts {
49+
(Self :: { $( $name:ident : $ty:ty ,)+ }) => {
50+
$(
51+
#[doc = concat!(
52+
"See the inherent [`", stringify!($name), "`][",
53+
"Self::", stringify!($name), "] constant."
54+
)]
55+
const $name: $ty = Self:: $name;
56+
)+
57+
};
4958
($base:ident :: { $( $name:ident : $ty:ty ,)+ }) => {
50-
$(const $name: $ty = $base :: $name;)+
59+
$(
60+
#[doc = concat!(
61+
"See the standard library [`", stringify!($name), "`][",
62+
stringify!($base), "::", stringify!($name), "] constant."
63+
)]
64+
const $name: $ty = $base :: $name;
65+
)+
5166
};
5267
}

0 commit comments

Comments
 (0)