diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2020-05-04 08:26:39 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2020-05-04 08:26:39 -0500 |
| commit | 55e37f9f02af4eec5c52413e3219bef838beadab (patch) | |
| tree | 3ca1d54900510da4844536c10e643a176ddab642 | |
| parent | 8bef0a3683c0a5dad40ee5889364ba206fc3af1f (diff) | |
| download | rust-55e37f9f02af4eec5c52413e3219bef838beadab.tar.gz rust-55e37f9f02af4eec5c52413e3219bef838beadab.zip | |
Add examples to int macros
| -rw-r--r-- | src/libcore/num/int_macros.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 5035445ba93..ffd30b03f21 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -12,14 +12,36 @@ macro_rules! int_module { ($T:ident, #[$attr:meta]) => ( doc_comment! { concat!("The smallest value that can be represented by this integer type. -Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead."), +Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead. + +# Examples + +```rust +// deprecated way +let min = std::", stringify!($T), "::MIN; + +// intended way +let min = ", stringify!($T), "::MIN; +``` +"), #[$attr] pub const MIN: $T = $T::MIN; } doc_comment! { concat!("The largest value that can be represented by this integer type. -Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead."), +Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead. + +# Examples + +```rust +// deprecated way +let max = std::", stringify!($T), "::MAX; + +// intended way +let max = ", stringify!($T), "::MAX; +``` +"), #[$attr] pub const MAX: $T = $T::MAX; } |
