Skip to content

Commit 639785c

Browse files
authored
Rollup merge of rust-lang#80958 - bstrie:deptbdnums, r=KodrAus
Deprecate-in-future the constants superceded by RFC 2700 Successor to rust-lang#78335, re-opened after addressing the issues tracked in rust-lang#68490. This PR makes use of the new ability to explicitly annotate an item as triggering the deprecated-in-future lint (via `rustc_deprecated(since="TBD"`, see rust-lang#78381). We might call this *soft deprecation*; unlike with deprecation, users will *not* receive warnings when compiling code that uses these items *unless* they opt-in via `#[warn(deprecated_in_future)]`. Like deprecation, soft deprecation causes documentation to formally acknowledge that an item is marked for eventual deprecation (at a non-specific point in the future). With this new ability, we can sidestep all debate about when or on what timeframe something ought to be deprecated; as long as we can agree that something ought to be deprecated, we can receive much of the benefits of deprecation with none of the drawbacks. For these items specifically, the libs team has already agreed that they should be deprecated (see rust-lang#68490 (comment)).
2 parents 003431a + c0c607c commit 639785c

File tree

22 files changed

+241
-90
lines changed

22 files changed

+241
-90
lines changed

Diff for: library/core/src/iter/adapters/chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::iter::{DoubleEndedIterator, FusedIterator, Iterator, TrustedLen};
2-
use crate::{ops::Try, usize};
2+
use crate::ops::Try;
33

44
/// An iterator that links two iterators together, in a chain.
55
///

Diff for: library/core/src/num/f32.rs

+60-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
//! This module provides constants which are specific to the implementation
2-
//! of the `f32` floating point data type.
1+
//! Constants specific to the `f32` single-precision floating point type.
32
//!
43
//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
54
//!
65
//! Mathematically significant numbers are provided in the `consts` sub-module.
76
//!
8-
//! Although using these constants won’t cause compilation warnings,
9-
//! new code should use the associated constants directly on the primitive type.
7+
//! For the constants defined directly in this module
8+
//! (as distinct from those defined in the `consts` sub-module),
9+
//! new code should instead use the associated constants
10+
//! defined directly on the `f32` type.
1011
1112
#![stable(feature = "rust1", since = "1.0.0")]
1213

@@ -23,12 +24,14 @@ use crate::num::FpCategory;
2324
///
2425
/// ```rust
2526
/// // deprecated way
27+
/// # #[allow(deprecated, deprecated_in_future)]
2628
/// let r = std::f32::RADIX;
2729
///
2830
/// // intended way
2931
/// let r = f32::RADIX;
3032
/// ```
3133
#[stable(feature = "rust1", since = "1.0.0")]
34+
#[rustc_deprecated(since = "TBD", reason = "replaced by the `RADIX` associated constant on `f32`")]
3235
pub const RADIX: u32 = f32::RADIX;
3336

3437
/// Number of significant digits in base 2.
@@ -38,12 +41,17 @@ pub const RADIX: u32 = f32::RADIX;
3841
///
3942
/// ```rust
4043
/// // deprecated way
44+
/// # #[allow(deprecated, deprecated_in_future)]
4145
/// let d = std::f32::MANTISSA_DIGITS;
4246
///
4347
/// // intended way
4448
/// let d = f32::MANTISSA_DIGITS;
4549
/// ```
4650
#[stable(feature = "rust1", since = "1.0.0")]
51+
#[rustc_deprecated(
52+
since = "TBD",
53+
reason = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
54+
)]
4755
pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
4856

4957
/// Approximate number of significant digits in base 10.
@@ -53,12 +61,14 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
5361
///
5462
/// ```rust
5563
/// // deprecated way
64+
/// # #[allow(deprecated, deprecated_in_future)]
5665
/// let d = std::f32::DIGITS;
5766
///
5867
/// // intended way
5968
/// let d = f32::DIGITS;
6069
/// ```
6170
#[stable(feature = "rust1", since = "1.0.0")]
71+
#[rustc_deprecated(since = "TBD", reason = "replaced by the `DIGITS` associated constant on `f32`")]
6272
pub const DIGITS: u32 = f32::DIGITS;
6373

6474
/// [Machine epsilon] value for `f32`.
@@ -72,12 +82,17 @@ pub const DIGITS: u32 = f32::DIGITS;
7282
///
7383
/// ```rust
7484
/// // deprecated way
85+
/// # #[allow(deprecated, deprecated_in_future)]
7586
/// let e = std::f32::EPSILON;
7687
///
7788
/// // intended way
7889
/// let e = f32::EPSILON;
7990
/// ```
8091
#[stable(feature = "rust1", since = "1.0.0")]
92+
#[rustc_deprecated(
93+
since = "TBD",
94+
reason = "replaced by the `EPSILON` associated constant on `f32`"
95+
)]
8196
pub const EPSILON: f32 = f32::EPSILON;
8297

8398
/// Smallest finite `f32` value.
@@ -87,12 +102,14 @@ pub const EPSILON: f32 = f32::EPSILON;
87102
///
88103
/// ```rust
89104
/// // deprecated way
105+
/// # #[allow(deprecated, deprecated_in_future)]
90106
/// let min = std::f32::MIN;
91107
///
92108
/// // intended way
93109
/// let min = f32::MIN;
94110
/// ```
95111
#[stable(feature = "rust1", since = "1.0.0")]
112+
#[rustc_deprecated(since = "TBD", reason = "replaced by the `MIN` associated constant on `f32`")]
96113
pub const MIN: f32 = f32::MIN;
97114

98115
/// Smallest positive normal `f32` value.
@@ -102,12 +119,17 @@ pub const MIN: f32 = f32::MIN;
102119
///
103120
/// ```rust
104121
/// // deprecated way
122+
/// # #[allow(deprecated, deprecated_in_future)]
105123
/// let min = std::f32::MIN_POSITIVE;
106124
///
107125
/// // intended way
108126
/// let min = f32::MIN_POSITIVE;
109127
/// ```
110128
#[stable(feature = "rust1", since = "1.0.0")]
129+
#[rustc_deprecated(
130+
since = "TBD",
131+
reason = "replaced by the `MIN_POSITIVE` associated constant on `f32`"
132+
)]
111133
pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
112134

113135
/// Largest finite `f32` value.
@@ -117,12 +139,14 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
117139
///
118140
/// ```rust
119141
/// // deprecated way
142+
/// # #[allow(deprecated, deprecated_in_future)]
120143
/// let max = std::f32::MAX;
121144
///
122145
/// // intended way
123146
/// let max = f32::MAX;
124147
/// ```
125148
#[stable(feature = "rust1", since = "1.0.0")]
149+
#[rustc_deprecated(since = "TBD", reason = "replaced by the `MAX` associated constant on `f32`")]
126150
pub const MAX: f32 = f32::MAX;
127151

128152
/// One greater than the minimum possible normal power of 2 exponent.
@@ -132,12 +156,17 @@ pub const MAX: f32 = f32::MAX;
132156
///
133157
/// ```rust
134158
/// // deprecated way
159+
/// # #[allow(deprecated, deprecated_in_future)]
135160
/// let min = std::f32::MIN_EXP;
136161
///
137162
/// // intended way
138163
/// let min = f32::MIN_EXP;
139164
/// ```
140165
#[stable(feature = "rust1", since = "1.0.0")]
166+
#[rustc_deprecated(
167+
since = "TBD",
168+
reason = "replaced by the `MIN_EXP` associated constant on `f32`"
169+
)]
141170
pub const MIN_EXP: i32 = f32::MIN_EXP;
142171

143172
/// Maximum possible power of 2 exponent.
@@ -147,12 +176,17 @@ pub const MIN_EXP: i32 = f32::MIN_EXP;
147176
///
148177
/// ```rust
149178
/// // deprecated way
179+
/// # #[allow(deprecated, deprecated_in_future)]
150180
/// let max = std::f32::MAX_EXP;
151181
///
152182
/// // intended way
153183
/// let max = f32::MAX_EXP;
154184
/// ```
155185
#[stable(feature = "rust1", since = "1.0.0")]
186+
#[rustc_deprecated(
187+
since = "TBD",
188+
reason = "replaced by the `MAX_EXP` associated constant on `f32`"
189+
)]
156190
pub const MAX_EXP: i32 = f32::MAX_EXP;
157191

158192
/// Minimum possible normal power of 10 exponent.
@@ -162,12 +196,17 @@ pub const MAX_EXP: i32 = f32::MAX_EXP;
162196
///
163197
/// ```rust
164198
/// // deprecated way
199+
/// # #[allow(deprecated, deprecated_in_future)]
165200
/// let min = std::f32::MIN_10_EXP;
166201
///
167202
/// // intended way
168203
/// let min = f32::MIN_10_EXP;
169204
/// ```
170205
#[stable(feature = "rust1", since = "1.0.0")]
206+
#[rustc_deprecated(
207+
since = "TBD",
208+
reason = "replaced by the `MIN_10_EXP` associated constant on `f32`"
209+
)]
171210
pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
172211

173212
/// Maximum possible power of 10 exponent.
@@ -177,12 +216,17 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
177216
///
178217
/// ```rust
179218
/// // deprecated way
219+
/// # #[allow(deprecated, deprecated_in_future)]
180220
/// let max = std::f32::MAX_10_EXP;
181221
///
182222
/// // intended way
183223
/// let max = f32::MAX_10_EXP;
184224
/// ```
185225
#[stable(feature = "rust1", since = "1.0.0")]
226+
#[rustc_deprecated(
227+
since = "TBD",
228+
reason = "replaced by the `MAX_10_EXP` associated constant on `f32`"
229+
)]
186230
pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
187231

188232
/// Not a Number (NaN).
@@ -192,12 +236,14 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
192236
///
193237
/// ```rust
194238
/// // deprecated way
239+
/// # #[allow(deprecated, deprecated_in_future)]
195240
/// let nan = std::f32::NAN;
196241
///
197242
/// // intended way
198243
/// let nan = f32::NAN;
199244
/// ```
200245
#[stable(feature = "rust1", since = "1.0.0")]
246+
#[rustc_deprecated(since = "TBD", reason = "replaced by the `NAN` associated constant on `f32`")]
201247
pub const NAN: f32 = f32::NAN;
202248

203249
/// Infinity (∞).
@@ -207,12 +253,17 @@ pub const NAN: f32 = f32::NAN;
207253
///
208254
/// ```rust
209255
/// // deprecated way
256+
/// # #[allow(deprecated, deprecated_in_future)]
210257
/// let inf = std::f32::INFINITY;
211258
///
212259
/// // intended way
213260
/// let inf = f32::INFINITY;
214261
/// ```
215262
#[stable(feature = "rust1", since = "1.0.0")]
263+
#[rustc_deprecated(
264+
since = "TBD",
265+
reason = "replaced by the `INFINITY` associated constant on `f32`"
266+
)]
216267
pub const INFINITY: f32 = f32::INFINITY;
217268

218269
/// Negative infinity (−∞).
@@ -222,12 +273,17 @@ pub const INFINITY: f32 = f32::INFINITY;
222273
///
223274
/// ```rust
224275
/// // deprecated way
276+
/// # #[allow(deprecated, deprecated_in_future)]
225277
/// let ninf = std::f32::NEG_INFINITY;
226278
///
227279
/// // intended way
228280
/// let ninf = f32::NEG_INFINITY;
229281
/// ```
230282
#[stable(feature = "rust1", since = "1.0.0")]
283+
#[rustc_deprecated(
284+
since = "TBD",
285+
reason = "replaced by the `NEG_INFINITY` associated constant on `f32`"
286+
)]
231287
pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;
232288

233289
/// Basic mathematical constants.

0 commit comments

Comments
 (0)