Skip to content

Commit 46a7406

Browse files
committed
Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errors
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2 parents 81a7ada + 7e461a3 commit 46a7406

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+267
-347
lines changed

alloc/src/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ impl<T> [T] {
657657
/// ```
658658
#[rustc_allow_incoherent_impl]
659659
#[stable(feature = "rust1", since = "1.0.0")]
660-
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
660+
#[deprecated(since = "1.3.0", note = "renamed to join")]
661661
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
662662
where
663663
Self: Join<Separator>,

core/src/alloc/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ impl Layout {
419419
}
420420

421421
#[stable(feature = "alloc_layout", since = "1.28.0")]
422-
#[rustc_deprecated(
422+
#[deprecated(
423423
since = "1.52.0",
424-
reason = "Name does not follow std convention, use LayoutError",
424+
note = "Name does not follow std convention, use LayoutError",
425425
suggestion = "LayoutError"
426426
)]
427427
pub type LayoutErr = LayoutError;

core/src/alloc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pub use self::global::GlobalAlloc;
1010
#[stable(feature = "alloc_layout", since = "1.28.0")]
1111
pub use self::layout::Layout;
1212
#[stable(feature = "alloc_layout", since = "1.28.0")]
13-
#[rustc_deprecated(
13+
#[deprecated(
1414
since = "1.52.0",
15-
reason = "Name does not follow std convention, use LayoutError",
15+
note = "Name does not follow std convention, use LayoutError",
1616
suggestion = "LayoutError"
1717
)]
1818
#[allow(deprecated, deprecated_in_future)]

core/src/array/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<T, const N: usize> IntoIterator for [T; N] {
7979
impl<T, const N: usize> IntoIter<T, N> {
8080
/// Creates a new iterator over the given `array`.
8181
#[stable(feature = "array_value_iter", since = "1.51.0")]
82-
#[rustc_deprecated(since = "1.59.0", reason = "use `IntoIterator::into_iter` instead")]
82+
#[deprecated(since = "1.59.0", note = "use `IntoIterator::into_iter` instead")]
8383
pub fn new(array: [T; N]) -> Self {
8484
IntoIterator::into_iter(array)
8585
}

core/src/fmt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,10 +1653,10 @@ impl<'a> Formatter<'a> {
16531653
/// Flags for formatting
16541654
#[must_use]
16551655
#[stable(feature = "rust1", since = "1.0.0")]
1656-
#[rustc_deprecated(
1656+
#[deprecated(
16571657
since = "1.24.0",
1658-
reason = "use the `sign_plus`, `sign_minus`, `alternate`, \
1659-
or `sign_aware_zero_pad` methods instead"
1658+
note = "use the `sign_plus`, `sign_minus`, `alternate`, \
1659+
or `sign_aware_zero_pad` methods instead"
16601660
)]
16611661
pub fn flags(&self) -> u32 {
16621662
self.flags

core/src/hash/sip.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ use crate::ptr;
1414
///
1515
/// See: <https://131002.net/siphash>
1616
#[unstable(feature = "hashmap_internals", issue = "none")]
17-
#[rustc_deprecated(
18-
since = "1.13.0",
19-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
20-
)]
17+
#[deprecated(since = "1.13.0", note = "use `std::collections::hash_map::DefaultHasher` instead")]
2118
#[derive(Debug, Clone, Default)]
2219
#[doc(hidden)]
2320
pub struct SipHasher13 {
@@ -28,10 +25,7 @@ pub struct SipHasher13 {
2825
///
2926
/// See: <https://131002.net/siphash/>
3027
#[unstable(feature = "hashmap_internals", issue = "none")]
31-
#[rustc_deprecated(
32-
since = "1.13.0",
33-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
34-
)]
28+
#[deprecated(since = "1.13.0", note = "use `std::collections::hash_map::DefaultHasher` instead")]
3529
#[derive(Debug, Clone, Default)]
3630
struct SipHasher24 {
3731
hasher: Hasher<Sip24Rounds>,
@@ -50,10 +44,7 @@ struct SipHasher24 {
5044
/// it is not intended for cryptographic purposes. As such, all
5145
/// cryptographic uses of this implementation are _strongly discouraged_.
5246
#[stable(feature = "rust1", since = "1.0.0")]
53-
#[rustc_deprecated(
54-
since = "1.13.0",
55-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
56-
)]
47+
#[deprecated(since = "1.13.0", note = "use `std::collections::hash_map::DefaultHasher` instead")]
5748
#[derive(Debug, Clone, Default)]
5849
pub struct SipHasher(SipHasher24);
5950

@@ -153,9 +144,9 @@ impl SipHasher {
153144
/// Creates a new `SipHasher` with the two initial keys set to 0.
154145
#[inline]
155146
#[stable(feature = "rust1", since = "1.0.0")]
156-
#[rustc_deprecated(
147+
#[deprecated(
157148
since = "1.13.0",
158-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
149+
note = "use `std::collections::hash_map::DefaultHasher` instead"
159150
)]
160151
#[must_use]
161152
pub fn new() -> SipHasher {
@@ -165,9 +156,9 @@ impl SipHasher {
165156
/// Creates a `SipHasher` that is keyed off the provided keys.
166157
#[inline]
167158
#[stable(feature = "rust1", since = "1.0.0")]
168-
#[rustc_deprecated(
159+
#[deprecated(
169160
since = "1.13.0",
170-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
161+
note = "use `std::collections::hash_map::DefaultHasher` instead"
171162
)]
172163
#[must_use]
173164
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher {
@@ -179,9 +170,9 @@ impl SipHasher13 {
179170
/// Creates a new `SipHasher13` with the two initial keys set to 0.
180171
#[inline]
181172
#[unstable(feature = "hashmap_internals", issue = "none")]
182-
#[rustc_deprecated(
173+
#[deprecated(
183174
since = "1.13.0",
184-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
175+
note = "use `std::collections::hash_map::DefaultHasher` instead"
185176
)]
186177
pub fn new() -> SipHasher13 {
187178
SipHasher13::new_with_keys(0, 0)
@@ -190,9 +181,9 @@ impl SipHasher13 {
190181
/// Creates a `SipHasher13` that is keyed off the provided keys.
191182
#[inline]
192183
#[unstable(feature = "hashmap_internals", issue = "none")]
193-
#[rustc_deprecated(
184+
#[deprecated(
194185
since = "1.13.0",
195-
reason = "use `std::collections::hash_map::DefaultHasher` instead"
186+
note = "use `std::collections::hash_map::DefaultHasher` instead"
196187
)]
197188
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
198189
SipHasher13 { hasher: Hasher::new_with_keys(key0, key1) }

core/src/intrinsics.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ use crate::mem;
6363
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
6464

6565
#[stable(feature = "drop_in_place", since = "1.8.0")]
66-
#[rustc_deprecated(
67-
reason = "no longer an intrinsic - use `ptr::drop_in_place` directly",
68-
since = "1.52.0"
69-
)]
66+
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
7067
#[inline]
7168
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
7269
// SAFETY: see `ptr::drop_in_place`

core/src/macros/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ macro_rules! matches {
410410
/// ```
411411
#[macro_export]
412412
#[stable(feature = "rust1", since = "1.0.0")]
413-
#[rustc_deprecated(since = "1.39.0", reason = "use the `?` operator instead")]
413+
#[deprecated(since = "1.39.0", note = "use the `?` operator instead")]
414414
#[doc(alias = "?")]
415415
macro_rules! r#try {
416416
($expr:expr $(,)?) => {
@@ -1536,10 +1536,7 @@ pub(crate) mod builtin {
15361536
#[rustc_builtin_macro]
15371537
#[stable(feature = "rust1", since = "1.0.0")]
15381538
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
1539-
#[rustc_deprecated(
1540-
since = "1.52.0",
1541-
reason = "rustc-serialize is deprecated and no longer supported"
1542-
)]
1539+
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
15431540
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
15441541
pub macro RustcDecodable($item:item) {
15451542
/* compiler built-in */
@@ -1549,10 +1546,7 @@ pub(crate) mod builtin {
15491546
#[rustc_builtin_macro]
15501547
#[stable(feature = "rust1", since = "1.0.0")]
15511548
#[allow_internal_unstable(core_intrinsics)]
1552-
#[rustc_deprecated(
1553-
since = "1.52.0",
1554-
reason = "rustc-serialize is deprecated and no longer supported"
1555-
)]
1549+
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
15561550
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
15571551
pub macro RustcEncodable($item:item) {
15581552
/* compiler built-in */

core/src/mem/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pub const unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
408408
#[inline]
409409
#[must_use]
410410
#[stable(feature = "rust1", since = "1.0.0")]
411-
#[rustc_deprecated(reason = "use `align_of` instead", since = "1.2.0")]
411+
#[deprecated(note = "use `align_of` instead", since = "1.2.0")]
412412
pub fn min_align_of<T>() -> usize {
413413
intrinsics::min_align_of::<T>()
414414
}
@@ -431,7 +431,7 @@ pub fn min_align_of<T>() -> usize {
431431
#[inline]
432432
#[must_use]
433433
#[stable(feature = "rust1", since = "1.0.0")]
434-
#[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
434+
#[deprecated(note = "use `align_of_val` instead", since = "1.2.0")]
435435
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
436436
// SAFETY: val is a reference, so it's a valid raw pointer
437437
unsafe { intrinsics::min_align_of_val(val) }
@@ -673,7 +673,7 @@ pub unsafe fn zeroed<T>() -> T {
673673
/// [inv]: MaybeUninit#initialization-invariant
674674
#[inline(always)]
675675
#[must_use]
676-
#[rustc_deprecated(since = "1.39.0", reason = "use `mem::MaybeUninit` instead")]
676+
#[deprecated(since = "1.39.0", note = "use `mem::MaybeUninit` instead")]
677677
#[stable(feature = "rust1", since = "1.0.0")]
678678
#[allow(deprecated_in_future)]
679679
#[allow(deprecated)]

core/src/num/f32.rs

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::num::FpCategory;
3131
/// let r = f32::RADIX;
3232
/// ```
3333
#[stable(feature = "rust1", since = "1.0.0")]
34-
#[rustc_deprecated(since = "TBD", reason = "replaced by the `RADIX` associated constant on `f32`")]
34+
#[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f32`")]
3535
pub const RADIX: u32 = f32::RADIX;
3636

3737
/// Number of significant digits in base 2.
@@ -48,9 +48,9 @@ pub const RADIX: u32 = f32::RADIX;
4848
/// let d = f32::MANTISSA_DIGITS;
4949
/// ```
5050
#[stable(feature = "rust1", since = "1.0.0")]
51-
#[rustc_deprecated(
51+
#[deprecated(
5252
since = "TBD",
53-
reason = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
53+
note = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
5454
)]
5555
pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
5656

@@ -68,7 +68,7 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
6868
/// let d = f32::DIGITS;
6969
/// ```
7070
#[stable(feature = "rust1", since = "1.0.0")]
71-
#[rustc_deprecated(since = "TBD", reason = "replaced by the `DIGITS` associated constant on `f32`")]
71+
#[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f32`")]
7272
pub const DIGITS: u32 = f32::DIGITS;
7373

7474
/// [Machine epsilon] value for `f32`.
@@ -89,10 +89,7 @@ pub const DIGITS: u32 = f32::DIGITS;
8989
/// let e = f32::EPSILON;
9090
/// ```
9191
#[stable(feature = "rust1", since = "1.0.0")]
92-
#[rustc_deprecated(
93-
since = "TBD",
94-
reason = "replaced by the `EPSILON` associated constant on `f32`"
95-
)]
92+
#[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f32`")]
9693
pub const EPSILON: f32 = f32::EPSILON;
9794

9895
/// Smallest finite `f32` value.
@@ -109,7 +106,7 @@ pub const EPSILON: f32 = f32::EPSILON;
109106
/// let min = f32::MIN;
110107
/// ```
111108
#[stable(feature = "rust1", since = "1.0.0")]
112-
#[rustc_deprecated(since = "TBD", reason = "replaced by the `MIN` associated constant on `f32`")]
109+
#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f32`")]
113110
pub const MIN: f32 = f32::MIN;
114111

115112
/// Smallest positive normal `f32` value.
@@ -126,10 +123,7 @@ pub const MIN: f32 = f32::MIN;
126123
/// let min = f32::MIN_POSITIVE;
127124
/// ```
128125
#[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-
)]
126+
#[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f32`")]
133127
pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
134128

135129
/// Largest finite `f32` value.
@@ -146,7 +140,7 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
146140
/// let max = f32::MAX;
147141
/// ```
148142
#[stable(feature = "rust1", since = "1.0.0")]
149-
#[rustc_deprecated(since = "TBD", reason = "replaced by the `MAX` associated constant on `f32`")]
143+
#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f32`")]
150144
pub const MAX: f32 = f32::MAX;
151145

152146
/// One greater than the minimum possible normal power of 2 exponent.
@@ -163,10 +157,7 @@ pub const MAX: f32 = f32::MAX;
163157
/// let min = f32::MIN_EXP;
164158
/// ```
165159
#[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-
)]
160+
#[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f32`")]
170161
pub const MIN_EXP: i32 = f32::MIN_EXP;
171162

172163
/// Maximum possible power of 2 exponent.
@@ -183,10 +174,7 @@ pub const MIN_EXP: i32 = f32::MIN_EXP;
183174
/// let max = f32::MAX_EXP;
184175
/// ```
185176
#[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-
)]
177+
#[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f32`")]
190178
pub const MAX_EXP: i32 = f32::MAX_EXP;
191179

192180
/// Minimum possible normal power of 10 exponent.
@@ -203,10 +191,7 @@ pub const MAX_EXP: i32 = f32::MAX_EXP;
203191
/// let min = f32::MIN_10_EXP;
204192
/// ```
205193
#[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-
)]
194+
#[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f32`")]
210195
pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
211196

212197
/// Maximum possible power of 10 exponent.
@@ -223,10 +208,7 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
223208
/// let max = f32::MAX_10_EXP;
224209
/// ```
225210
#[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-
)]
211+
#[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f32`")]
230212
pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
231213

232214
/// Not a Number (NaN).
@@ -243,7 +225,7 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
243225
/// let nan = f32::NAN;
244226
/// ```
245227
#[stable(feature = "rust1", since = "1.0.0")]
246-
#[rustc_deprecated(since = "TBD", reason = "replaced by the `NAN` associated constant on `f32`")]
228+
#[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f32`")]
247229
pub const NAN: f32 = f32::NAN;
248230

249231
/// Infinity (∞).
@@ -260,10 +242,7 @@ pub const NAN: f32 = f32::NAN;
260242
/// let inf = f32::INFINITY;
261243
/// ```
262244
#[stable(feature = "rust1", since = "1.0.0")]
263-
#[rustc_deprecated(
264-
since = "TBD",
265-
reason = "replaced by the `INFINITY` associated constant on `f32`"
266-
)]
245+
#[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f32`")]
267246
pub const INFINITY: f32 = f32::INFINITY;
268247

269248
/// Negative infinity (−∞).
@@ -280,10 +259,7 @@ pub const INFINITY: f32 = f32::INFINITY;
280259
/// let ninf = f32::NEG_INFINITY;
281260
/// ```
282261
#[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-
)]
262+
#[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f32`")]
287263
pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;
288264

289265
/// Basic mathematical constants.

0 commit comments

Comments
 (0)