Skip to content

Commit 3529834

Browse files
committed
Add "soft deprecation" notice to old min/max_value() docs
1 parent 271ba5a commit 3529834

File tree

1 file changed

+60
-40
lines changed

1 file changed

+60
-40
lines changed

src/libcore/num/mod.rs

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -279,28 +279,6 @@ $EndFeature, "
279279
pub const MAX: Self = !Self::MIN;
280280
}
281281

282-
doc_comment! {
283-
"Returns the smallest value that can be represented by this integer type.",
284-
#[stable(feature = "rust1", since = "1.0.0")]
285-
#[inline(always)]
286-
#[rustc_promotable]
287-
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
288-
pub const fn min_value() -> Self {
289-
Self::MIN
290-
}
291-
}
292-
293-
doc_comment! {
294-
"Returns the largest value that can be represented by this integer type.",
295-
#[stable(feature = "rust1", since = "1.0.0")]
296-
#[inline(always)]
297-
#[rustc_promotable]
298-
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
299-
pub const fn max_value() -> Self {
300-
Self::MAX
301-
}
302-
}
303-
304282
doc_comment! {
305283
concat!("Converts a string slice in a given base to an integer.
306284
@@ -2351,6 +2329,38 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
23512329
unsafe { mem::transmute(bytes) }
23522330
}
23532331
}
2332+
2333+
doc_comment! {
2334+
concat!("**This method is soft-deprecated.**
2335+
2336+
Although using it won’t cause compilation warning,
2337+
new code should use [`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN) instead.
2338+
2339+
Returns the smallest value that can be represented by this integer type."),
2340+
#[stable(feature = "rust1", since = "1.0.0")]
2341+
#[inline(always)]
2342+
#[rustc_promotable]
2343+
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
2344+
pub const fn min_value() -> Self {
2345+
Self::MIN
2346+
}
2347+
}
2348+
2349+
doc_comment! {
2350+
concat!("**This method is soft-deprecated.**
2351+
2352+
Although using it won’t cause compilation warning,
2353+
new code should use [`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX) instead.
2354+
2355+
Returns the largest value that can be represented by this integer type."),
2356+
#[stable(feature = "rust1", since = "1.0.0")]
2357+
#[inline(always)]
2358+
#[rustc_promotable]
2359+
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
2360+
pub const fn max_value() -> Self {
2361+
Self::MAX
2362+
}
2363+
}
23542364
}
23552365
}
23562366

@@ -2454,24 +2464,6 @@ $EndFeature, "
24542464
pub const MAX: Self = !0;
24552465
}
24562466

2457-
doc_comment! {
2458-
"Returns the smallest value that can be represented by this integer type.",
2459-
#[stable(feature = "rust1", since = "1.0.0")]
2460-
#[rustc_promotable]
2461-
#[inline(always)]
2462-
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
2463-
pub const fn min_value() -> Self { Self::MIN }
2464-
}
2465-
2466-
doc_comment! {
2467-
"Returns the largest value that can be represented by this integer type.",
2468-
#[stable(feature = "rust1", since = "1.0.0")]
2469-
#[rustc_promotable]
2470-
#[inline(always)]
2471-
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
2472-
pub const fn max_value() -> Self { Self::MAX }
2473-
}
2474-
24752467
doc_comment! {
24762468
concat!("Converts a string slice in a given base to an integer.
24772469
@@ -4277,6 +4269,34 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
42774269
unsafe { mem::transmute(bytes) }
42784270
}
42794271
}
4272+
4273+
doc_comment! {
4274+
concat!("**This method is soft-deprecated.**
4275+
4276+
Although using it won’t cause compilation warning,
4277+
new code should use [`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN) instead.
4278+
4279+
Returns the smallest value that can be represented by this integer type."),
4280+
#[stable(feature = "rust1", since = "1.0.0")]
4281+
#[rustc_promotable]
4282+
#[inline(always)]
4283+
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
4284+
pub const fn min_value() -> Self { Self::MIN }
4285+
}
4286+
4287+
doc_comment! {
4288+
concat!("**This method is soft-deprecated.**
4289+
4290+
Although using it won’t cause compilation warning,
4291+
new code should use [`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX) instead.
4292+
4293+
Returns the largest value that can be represented by this integer type."),
4294+
#[stable(feature = "rust1", since = "1.0.0")]
4295+
#[rustc_promotable]
4296+
#[inline(always)]
4297+
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
4298+
pub const fn max_value() -> Self { Self::MAX }
4299+
}
42804300
}
42814301
}
42824302

0 commit comments

Comments
 (0)