]> git.proxmox.com Git - rustc.git/blob - library/core/src/num/int_macros.rs
New upstream version 1.47.0~beta.2+dfsg1
[rustc.git] / library / core / src / num / int_macros.rs
1 #![doc(hidden)]
2
3 macro_rules! doc_comment {
4 ($x:expr, $($tt:tt)*) => {
5 #[doc = $x]
6 $($tt)*
7 };
8 }
9
10 macro_rules! int_module {
11 ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
12 ($T:ident, #[$attr:meta]) => (
13 doc_comment! {
14 concat!("The smallest value that can be represented by this integer type.
15 Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead.
16
17 # Examples
18
19 ```rust
20 // deprecated way
21 let min = std::", stringify!($T), "::MIN;
22
23 // intended way
24 let min = ", stringify!($T), "::MIN;
25 ```
26 "),
27 #[$attr]
28 pub const MIN: $T = $T::MIN;
29 }
30
31 doc_comment! {
32 concat!("The largest value that can be represented by this integer type.
33 Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead.
34
35 # Examples
36
37 ```rust
38 // deprecated way
39 let max = std::", stringify!($T), "::MAX;
40
41 // intended way
42 let max = ", stringify!($T), "::MAX;
43 ```
44 "),
45 #[$attr]
46 pub const MAX: $T = $T::MAX;
47 }
48 )
49 }