10000 Stabilize assoc_int_consts associated int/float constants by faern · Pull Request #68952 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Stabilize assoc_int_consts associated int/float constants #68952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 4, 2020
Merged
Prev Previous commit
Next Next commit
Add "soft deprecation" notice to old min/max_value() docs
  • Loading branch information
faern committed Feb 12, 2020
commit 35298349c3efd75cd8050f9f23e4bf1409d96118
100 changes: 60 additions & 40 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,28 +279,6 @@ $EndFeature, "
pub const MAX: Self = !Self::MIN;
}

doc_comment! {
"Returns the smallest value that can be represented by this integer type.",
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
pub const fn min_value() -> Self {
Self::MIN
}
}

doc_comment! {
"Returns the largest value that can be represented by this integer type.",
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self {
Self::MAX
}
}

doc_comment! {
concat!("Converts a string slice in a given base to an integer.

Expand Down Expand Up @@ -2351,6 +2329,38 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
unsafe { mem::transmute(bytes) }
}
}

doc_comment! {
concat!("**This method is soft-deprecated.**

Although using it won’t cause compilation warning,
new code should use [`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN) instead.

Returns the smallest value that can be represented by this integer type."),
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
pub const fn min_value() -> Self {
Self::MIN
}
}

doc_comment! {
concat!("**This method is soft-deprecated.**

Although using it won’t cause compilation warning,
new code should use [`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX) instead.

Returns the largest value that can be represented by this integer type."),
#[stable(feature = "rust1", since = "1.0.0")]
#[inline(always)]
#[rustc_promotable]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self {
Self::MAX
}
}
}
}

Expand Down Expand Up @@ -2454,24 +2464,6 @@ $EndFeature, "
pub const MAX: Self = !0;
}

doc_comment! {
"Returns the smallest value that can be represented by this integer type.",
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn min_value() -> Self { Self::MIN }
}

doc_comment! {
"Returns the largest value that can be represented by this integer type.",
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self { Self::MAX }
}

doc_comment! {
concat!("Converts a string slice in a given base to an integer.

Expand Down Expand Up @@ -4277,6 +4269,34 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
unsafe { mem::transmute(bytes) }
}
}

doc_comment! {
concat!("**This method is soft-deprecated.**

Although using it won’t cause compilation warning,
new code should use [`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN) instead.

Returns the smallest value that can be represented by this integer type."),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn min_value() -> Self { Self::MIN }
}

doc_comment! {
concat!("**This method is soft-deprecated.**

Although using it won’t cause compilation warning,
new code should use [`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX) instead.

Returns the largest value that can be represented by this integer type."),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline(always)]
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
pub const fn max_value() -> Self { Self::MAX }
}
}
}

Expand Down
0