Skip to content

Commit f5929b4

Browse files
authored
Unrolled build for rust-lang#121272
Rollup merge of rust-lang#121272 - pitaj:diag_items-legacy_numeric_constants, r=Nilstrieb Add diagnostic items for legacy numeric constants For rust-lang/rust-clippy#12312
2 parents 43d3470 + d9c1c73 commit f5929b4

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

library/core/src/num/f32.rs

+14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use crate::num::FpCategory;
3232
/// ```
3333
#[stable(feature = "rust1", since = "1.0.0")]
3434
#[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f32`")]
35+
#[rustc_diagnostic_item = "f32_legacy_const_radix"]
3536
pub const RADIX: u32 = f32::RADIX;
3637

3738
/// Number of significant digits in base 2.
@@ -52,6 +53,7 @@ pub const RADIX: u32 = f32::RADIX;
5253
since = "TBD",
5354
note = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
5455
)]
56+
#[rustc_diagnostic_item = "f32_legacy_const_mantissa_dig"]
5557
pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
5658

5759
/// Approximate number of significant digits in base 10.
@@ -69,6 +71,7 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
6971
/// ```
7072
#[stable(feature = "rust1", since = "1.0.0")]
7173
#[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f32`")]
74+
#[rustc_diagnostic_item = "f32_legacy_const_digits"]
7275
pub const DIGITS: u32 = f32::DIGITS;
7376

7477
/// [Machine epsilon] value for `f32`.
@@ -90,6 +93,7 @@ pub const DIGITS: u32 = f32::DIGITS;
9093
/// ```
9194
#[stable(feature = "rust1", since = "1.0.0")]
9295
#[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f32`")]
96+
#[rustc_diagnostic_item = "f32_legacy_const_epsilon"]
9397
pub const EPSILON: f32 = f32::EPSILON;
9498

9599
/// Smallest finite `f32` value.
@@ -107,6 +111,7 @@ pub const EPSILON: f32 = f32::EPSILON;
107111
/// ```
108112
#[stable(feature = "rust1", since = "1.0.0")]
109113
#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f32`")]
114+
#[rustc_diagnostic_item = "f32_legacy_const_min"]
110115
pub const MIN: f32 = f32::MIN;
111116

112117
/// Smallest positive normal `f32` value.
@@ -124,6 +129,7 @@ pub const MIN: f32 = f32::MIN;
124129
/// ```
125130
#[stable(feature = "rust1", since = "1.0.0")]
126131
#[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f32`")]
132+
#[rustc_diagnostic_item = "f32_legacy_const_min_positive"]
127133
pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
128134

129135
/// Largest finite `f32` value.
@@ -141,6 +147,7 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
141147
/// ```
142148
#[stable(feature = "rust1", since = "1.0.0")]
143149
#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f32`")]
150+
#[rustc_diagnostic_item = "f32_legacy_const_max"]
144151
pub const MAX: f32 = f32::MAX;
145152

146153
/// One greater than the minimum possible normal power of 2 exponent.
@@ -158,6 +165,7 @@ pub const MAX: f32 = f32::MAX;
158165
/// ```
159166
#[stable(feature = "rust1", since = "1.0.0")]
160167
#[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f32`")]
168+
#[rustc_diagnostic_item = "f32_legacy_const_min_exp"]
161169
pub const MIN_EXP: i32 = f32::MIN_EXP;
162170

163171
/// Maximum possible power of 2 exponent.
@@ -175,6 +183,7 @@ pub const MIN_EXP: i32 = f32::MIN_EXP;
175183
/// ```
176184
#[stable(feature = "rust1", since = "1.0.0")]
177185
#[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f32`")]
186+
#[rustc_diagnostic_item = "f32_legacy_const_max_exp"]
178187
pub const MAX_EXP: i32 = f32::MAX_EXP;
179188

180189
/// Minimum possible normal power of 10 exponent.
@@ -192,6 +201,7 @@ pub const MAX_EXP: i32 = f32::MAX_EXP;
192201
/// ```
193202
#[stable(feature = "rust1", since = "1.0.0")]
194203
#[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f32`")]
204+
#[rustc_diagnostic_item = "f32_legacy_const_min_10_exp"]
195205
pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
196206

197207
/// Maximum possible power of 10 exponent.
@@ -209,6 +219,7 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
209219
/// ```
210220
#[stable(feature = "rust1", since = "1.0.0")]
211221
#[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f32`")]
222+
#[rustc_diagnostic_item = "f32_legacy_const_max_10_exp"]
212223
pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
213224

214225
/// Not a Number (NaN).
@@ -226,6 +237,7 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
226237
/// ```
227238
#[stable(feature = "rust1", since = "1.0.0")]
228239
#[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f32`")]
240+
#[rustc_diagnostic_item = "f32_legacy_const_nan"]
229241
pub const NAN: f32 = f32::NAN;
230242

231243
/// Infinity (∞).
@@ -243,6 +255,7 @@ pub const NAN: f32 = f32::NAN;
243255
/// ```
244256
#[stable(feature = "rust1", since = "1.0.0")]
245257
#[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f32`")]
258+
#[rustc_diagnostic_item = "f32_legacy_const_infinity"]
246259
pub const INFINITY: f32 = f32::INFINITY;
247260

248261
/// Negative infinity (−∞).
@@ -260,6 +273,7 @@ pub const INFINITY: f32 = f32::INFINITY;
260273
/// ```
261274
#[stable(feature = "rust1", since = "1.0.0")]
262275
#[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f32`")]
276+
#[rustc_diagnostic_item = "f32_legacy_const_neg_infinity"]
263277
pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;
264278

265279
/// Basic mathematical constants.

library/core/src/num/f64.rs

+14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use crate::num::FpCategory;
3232
/// ```
3333
#[stable(feature = "rust1", since = "1.0.0")]
3434
#[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f64`")]
35+
#[rustc_diagnostic_item = "f64_legacy_const_radix"]
3536
pub const RADIX: u32 = f64::RADIX;
3637

3738
/// Number of significant digits in base 2.
@@ -52,6 +53,7 @@ pub const RADIX: u32 = f64::RADIX;
5253
since = "TBD",
5354
note = "replaced by the `MANTISSA_DIGITS` associated constant on `f64`"
5455
)]
56+
#[rustc_diagnostic_item = "f64_legacy_const_mantissa_dig"]
5557
pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS;
5658

5759
/// Approximate number of significant digits in base 10.
@@ -69,6 +71,7 @@ pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS;
6971
/// ```
7072
#[stable(feature = "rust1", since = "1.0.0")]
7173
#[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f64`")]
74+
#[rustc_diagnostic_item = "f64_legacy_const_digits"]
7275
pub const DIGITS: u32 = f64::DIGITS;
7376

7477
/// [Machine epsilon] value for `f64`.
@@ -90,6 +93,7 @@ pub const DIGITS: u32 = f64::DIGITS;
9093
/// ```
9194
#[stable(feature = "rust1", since = "1.0.0")]
9295
#[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f64`")]
96+
#[rustc_diagnostic_item = "f64_legacy_const_epsilon"]
9397
pub const EPSILON: f64 = f64::EPSILON;
9498

9599
/// Smallest finite `f64` value.
@@ -107,6 +111,7 @@ pub const EPSILON: f64 = f64::EPSILON;
107111
/// ```
108112
#[stable(feature = "rust1", since = "1.0.0")]
109113
#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f64`")]
114+
#[rustc_diagnostic_item = "f64_legacy_const_min"]
110115
pub const MIN: f64 = f64::MIN;
111116

112117
/// Smallest positive normal `f64` value.
@@ -124,6 +129,7 @@ pub const MIN: f64 = f64::MIN;
124129
/// ```
125130
#[stable(feature = "rust1", since = "1.0.0")]
126131
#[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f64`")]
132+
#[rustc_diagnostic_item = "f64_legacy_const_min_positive"]
127133
pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE;
128134

129135
/// Largest finite `f64` value.
@@ -141,6 +147,7 @@ pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE;
141147
/// ```
142148
#[stable(feature = "rust1", since = "1.0.0")]
143149
#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f64`")]
150+
#[rustc_diagnostic_item = "f64_legacy_const_max"]
144151
pub const MAX: f64 = f64::MAX;
145152

146153
/// One greater than the minimum possible normal power of 2 exponent.
@@ -158,6 +165,7 @@ pub const MAX: f64 = f64::MAX;
158165
/// ```
159166
#[stable(feature = "rust1", since = "1.0.0")]
160167
#[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f64`")]
168+
#[rustc_diagnostic_item = "f64_legacy_const_min_exp"]
161169
pub const MIN_EXP: i32 = f64::MIN_EXP;
162170

163171
/// Maximum possible power of 2 exponent.
@@ -175,6 +183,7 @@ pub const MIN_EXP: i32 = f64::MIN_EXP;
175183
/// ```
176184
#[stable(feature = "rust1", since = "1.0.0")]
177185
#[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f64`")]
186+
#[rustc_diagnostic_item = "f64_legacy_const_max_exp"]
178187
pub const MAX_EXP: i32 = f64::MAX_EXP;
179188

180189
/// Minimum possible normal power of 10 exponent.
@@ -192,6 +201,7 @@ pub const MAX_EXP: i32 = f64::MAX_EXP;
192201
/// ```
193202
#[stable(feature = "rust1", since = "1.0.0")]
194203
#[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f64`")]
204+
#[rustc_diagnostic_item = "f64_legacy_const_min_10_exp"]
195205
pub const MIN_10_EXP: i32 = f64::MIN_10_EXP;
196206

197207
/// Maximum possible power of 10 exponent.
@@ -209,6 +219,7 @@ pub const MIN_10_EXP: i32 = f64::MIN_10_EXP;
209219
/// ```
210220
#[stable(feature = "rust1", since = "1.0.0")]
211221
#[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f64`")]
222+
#[rustc_diagnostic_item = "f64_legacy_const_max_10_exp"]
212223
pub const MAX_10_EXP: i32 = f64::MAX_10_EXP;
213224

214225
/// Not a Number (NaN).
@@ -226,6 +237,7 @@ pub const MAX_10_EXP: i32 = f64::MAX_10_EXP;
226237
/// ```
227238
#[stable(feature = "rust1", since = "1.0.0")]
228239
#[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f64`")]
240+
#[rustc_diagnostic_item = "f64_legacy_const_nan"]
229241
pub const NAN: f64 = f64::NAN;
230242

231243
/// Infinity (∞).
@@ -243,6 +255,7 @@ pub const NAN: f64 = f64::NAN;
243255
/// ```
244256
#[stable(feature = "rust1", since = "1.0.0")]
245257
#[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f64`")]
258+
#[rustc_diagnostic_item = "f64_legacy_const_infinity"]
246259
pub const INFINITY: f64 = f64::INFINITY;
247260

248261
/// Negative infinity (−∞).
@@ -260,6 +273,7 @@ pub const INFINITY: f64 = f64::INFINITY;
260273
/// ```
261274
#[stable(feature = "rust1", since = "1.0.0")]
262275
#[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f64`")]
276+
#[rustc_diagnostic_item = "f64_legacy_const_neg_infinity"]
263277
pub const NEG_INFINITY: f64 = f64::NEG_INFINITY;
264278

265279
/// Basic mathematical constants.

library/core/src/num/int_macros.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3507,6 +3507,7 @@ macro_rules! int_impl {
35073507
#[rustc_promotable]
35083508
#[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
35093509
#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")]
3510+
#[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_min_value")]
35103511
pub const fn min_value() -> Self {
35113512
Self::MIN
35123513
}
@@ -3520,6 +3521,7 @@ macro_rules! int_impl {
35203521
#[rustc_promotable]
35213522
#[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
35223523
#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")]
3524+
#[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_max_value")]
35233525
pub const fn max_value() -> Self {
35243526
Self::MAX
35253527
}

library/core/src/num/shells/int_macros.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ macro_rules! int_module {
2020
///
2121
#[$attr]
2222
#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")]
23+
#[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_min")]
2324
pub const MIN: $T = $T::MIN;
2425

2526
#[doc = concat!(
@@ -39,6 +40,7 @@ macro_rules! int_module {
3940
///
4041
#[$attr]
4142
#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")]
43+
#[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_max")]
4244
pub const MAX: $T = $T::MAX;
4345
)
4446
}

0 commit comments

Comments
 (0)