diff options
| author | Linus Färnstrand <faern@faern.net> | 2020-02-04 18:13:26 +0100 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2020-02-12 20:20:55 +0100 |
| commit | 97bdd31b0eab51d0a51b8746123f910cd868dff3 (patch) | |
| tree | 483f99f3e815a8791e381fff9b0ab4fc061b8b27 /src/libcore/num | |
| parent | 35298349c3efd75cd8050f9f23e4bf1409d96118 (diff) | |
| download | rust-97bdd31b0eab51d0a51b8746123f910cd868dff3.tar.gz rust-97bdd31b0eab51d0a51b8746123f910cd868dff3.zip | |
Add "soft deprecation" notice to old MIN/MAX docs
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/int_macros.rs | 19 | ||||
| -rw-r--r-- | src/libcore/num/uint_macros.rs | 34 |
2 files changed, 41 insertions, 12 deletions
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 5c59fe25f64..d3d6db5a768 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -3,11 +3,18 @@ macro_rules! int_module { ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); ($T:ident, #[$attr:meta]) => ( - /// The smallest value that can be represented by this integer type. - #[$attr] - pub const MIN: $T = $T::min_value(); - /// The largest value that can be represented by this integer type. - #[$attr] - pub const MAX: $T = $T::max_value(); + 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."), + #[$attr] + pub const MIN: $T = $T::min_value(); + } + + 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."), + #[$attr] + pub const MAX: $T = $T::max_value(); + } ) } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index a94b541ddb9..ff16a1f38d8 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -1,13 +1,35 @@ #![doc(hidden)] +macro_rules! doc_comment { + ($x:expr, $($tt:tt)*) => { + #[doc = $x] + $($tt)* + }; +} + macro_rules! uint_module { ($T:ident) => (uint_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); ($T:ident, #[$attr:meta]) => ( - /// The smallest value that can be represented by this integer type. - #[$attr] - pub const MIN: $T = $T::min_value(); - /// The largest value that can be represented by this integer type. - #[$attr] - pub const MAX: $T = $T::max_value(); + doc_comment! { + concat!("**This method is soft-deprecated.** + + Although using it won’t cause compilation warning, + new code should use [`", stringify!($T), "::MIN", "`] instead. + + The smallest value that can be represented by this integer type."), + #[$attr] + pub const MIN: $T = $T::min_value(); + } + + doc_comment! { + concat!("**This method is soft-deprecated.** + + Although using it won’t cause compilation warning, + new code should use [`", stringify!($T), "::MAX", "`] instead. + + The largest value that can be represented by this integer type."), + #[$attr] + pub const MAX: $T = $T::max_value(); + } ) } |
