Skip to content

Commit

Permalink
Rename #[deprecated] to #[rustc_deprecated]
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Nov 20, 2015
1 parent 2228bac commit a613059
Show file tree
Hide file tree
Showing 47 changed files with 126 additions and 113 deletions.
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ The currently implemented features of the reference compiler are:

* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a
crate. Stability markers are also attributes: `#[stable]`,
`#[unstable]`, and `#[deprecated]` are the three levels.
`#[unstable]`, and `#[rustc_deprecated]` are the three levels.

* `start` - Allows use of the `#[start]` attribute, which changes the entry point
into a Rust program. This capability, especially the signature for the
Expand Down
2 changes: 1 addition & 1 deletion src/etc/featureck.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
lang_stable_since = language_feature_stats[name][4]
lib_stable_since = lib_feature_stats[name][4]

if lang_status != lib_status and lib_status != "deprecated":
if lang_status != lib_status and lib_status != "rustc_deprecated":
print("error: feature '%s' has lang status %s " +
"but lib status %s" % (name, lang_status, lib_status))
errors = True
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl<T: ?Sized> Deref for Arc<T> {
impl<T: Clone> Arc<T> {
#[unstable(feature = "arc_make_unique", reason = "renamed to Arc::make_mut",
issue = "27718")]
#[deprecated(since = "1.4.0", reason = "renamed to Arc::make_mut")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Arc::make_mut")]
pub fn make_unique(this: &mut Self) -> &mut T {
Arc::make_mut(this)
}
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
#![no_std]
#![cfg_attr(not(stage0), needs_allocator)]

#![cfg_attr(stage0, feature(rustc_attrs))]
#![cfg_attr(stage0, allow(unused_attributes))]
#![feature(allocator)]
#![feature(box_syntax)]
#![feature(coerce_unsized)]
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl<T: Clone> Rc<T> {
#[inline]
#[unstable(feature = "rc_make_unique", reason = "renamed to Rc::make_mut",
issue = "27718")]
#[deprecated(since = "1.4.0", reason = "renamed to Rc::make_mut")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Rc::make_mut")]
pub fn make_unique(&mut self) -> &mut T {
Rc::make_mut(self)
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<T: Ord> BinaryHeap<T> {
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
#[deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")]
#[rustc_deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")]
pub fn from_vec(vec: Vec<T>) -> BinaryHeap<T> {
BinaryHeap::from(vec)
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually",
issue = "27795")]
#[deprecated(since = "1.4.0", reason = "niche API")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
pub fn with_b(b: usize) -> BTreeMap<K, V> {
assert!(b > 1, "B must be greater than 1");
BTreeMap {
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<T: Ord> BTreeSet<T> {
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually",
issue = "27795")]
#[deprecated(since = "1.4.0", reason = "niche API")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
#[allow(deprecated)]
pub fn with_b(b: usize) -> BTreeSet<T> {
BTreeSet { map: BTreeMap::with_b(b) }
Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
// SNAP 1af31d4
#![allow(unused_attributes)]

#![cfg_attr(stage0, feature(rustc_attrs))]
#![cfg_attr(stage0, allow(unused_attributes))]
#![feature(alloc)]
#![feature(box_patterns)]
#![feature(box_syntax)]
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ pub trait SliceConcatExt<T: ?Sized> {
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.3.0", reason = "renamed to join")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
fn connect(&self, sep: &T) -> Self::Output;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ impl str {
/// assert_eq!(v, ["foo", "bar", "", "baz"]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.4.0", reason = "use lines() instead now")]
#[rustc_deprecated(since = "1.4.0", reason = "use lines() instead now")]
#[inline]
#[allow(deprecated)]
pub fn lines_any(&self) -> LinesAny {
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ impl String {
#[unstable(feature = "box_str2",
reason = "recently added, matches RFC",
issue = "27785")]
#[deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
pub fn into_boxed_slice(self) -> Box<str> {
self.into_boxed_str()
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ impl<T> VecDeque<T> {
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered",
issue = "27788")]
#[deprecated(since = "1.5.0", reason = "renamed to swap_remove_back")]
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_back")]
pub fn swap_back_remove(&mut self, index: usize) -> Option<T> {
self.swap_remove_back(index)
}
Expand Down Expand Up @@ -1101,7 +1101,7 @@ impl<T> VecDeque<T> {
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered",
issue = "27788")]
#[deprecated(since = "1.5.0", reason = "renamed to swap_remove_front")]
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_front")]
pub fn swap_front_remove(&mut self, index: usize) -> Option<T> {
self.swap_remove_front(index)
}
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4303,7 +4303,7 @@ impl<A> Iterator for StepBy<A, RangeFrom<A>> where
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters",
issue = "27777")]
#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[rustc_deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[allow(deprecated)]
pub struct RangeInclusive<A> {
range: ops::Range<A>,
Expand All @@ -4315,7 +4315,7 @@ pub struct RangeInclusive<A> {
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters",
issue = "27777")]
#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[rustc_deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[allow(deprecated)]
pub fn range_inclusive<A>(start: A, stop: A) -> RangeInclusive<A>
where A: Step + One + Clone
Expand All @@ -4329,7 +4329,7 @@ pub fn range_inclusive<A>(start: A, stop: A) -> RangeInclusive<A>
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters",
issue = "27777")]
#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[rustc_deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[allow(deprecated)]
impl<A> Iterator for RangeInclusive<A> where
A: PartialEq + Step + One + Clone,
Expand Down Expand Up @@ -4365,7 +4365,7 @@ impl<A> Iterator for RangeInclusive<A> where
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters",
issue = "27777")]
#[deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[rustc_deprecated(since = "1.5.0", reason = "replaced with ... syntax")]
#[allow(deprecated)]
impl<A> DoubleEndedIterator for RangeInclusive<A> where
A: PartialEq + Step + One + Clone,
Expand Down Expand Up @@ -4743,7 +4743,7 @@ pub fn once<T>(value: T) -> Once<T> {
///
/// If two sequences are equal up until the point where one ends,
/// the shorter sequence compares less.
#[deprecated(since = "1.4.0", reason = "use the equivalent methods on `Iterator` instead")]
#[rustc_deprecated(since = "1.4.0", reason = "use the equivalent methods on `Iterator` instead")]
#[unstable(feature = "iter_order_deprecated", reason = "needs review and revision",
issue = "27737")]
pub mod order {
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#![no_core]
#![deny(missing_docs)]

#![cfg_attr(stage0, feature(rustc_attrs))]
#![cfg_attr(stage0, allow(unused_attributes))]
#![feature(allow_internal_unstable)]
#![feature(associated_type_defaults)]
#![feature(concat_idents)]
Expand All @@ -80,7 +82,6 @@
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
#![feature(reflect)]
#![feature(rustc_attrs)]
#![feature(unwind_attributes)]
#![cfg_attr(stage0, feature(simd))]
#![cfg_attr(not(stage0), feature(repr_simd, platform_intrinsics))]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub fn size_of_val<T: ?Sized>(val: &T) -> usize {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(reason = "use `align_of` instead", since = "1.2.0")]
#[rustc_deprecated(reason = "use `align_of` instead", since = "1.2.0")]
pub fn min_align_of<T>() -> usize {
unsafe { intrinsics::min_align_of::<T>() }
}
Expand All @@ -176,7 +176,7 @@ pub fn min_align_of<T>() -> usize {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
#[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
unsafe { intrinsics::min_align_of_val(val) }
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<T> Option<T> {
#[unstable(feature = "as_slice",
reason = "waiting for mut conventions",
issue = "27776")]
#[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[allow(deprecated)]
pub fn as_mut_slice(&mut self) -> &mut [T] {
match *self {
Expand Down Expand Up @@ -695,7 +695,7 @@ impl<T> Option<T> {
#[inline]
#[unstable(feature = "as_slice", reason = "unsure of the utility here",
issue = "27776")]
#[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[allow(deprecated)]
pub fn as_slice(&self) -> &[T] {
match *self {
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<T, E> Result<T, E> {
#[inline]
#[unstable(feature = "as_slice", reason = "unsure of the utility here",
issue = "27776")]
#[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[allow(deprecated)]
pub fn as_slice(&self) -> &[T] {
match *self {
Expand Down Expand Up @@ -445,7 +445,7 @@ impl<T, E> Result<T, E> {
#[unstable(feature = "as_slice",
reason = "waiting for mut conventions",
issue = "27776")]
#[deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API, unclear of usefulness")]
#[allow(deprecated)]
pub fn as_mut_slice(&mut self) -> &mut [T] {
match *self {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#![unstable(feature = "core_simd",
reason = "needs an RFC to flesh out the design",
issue = "27731")]
#![deprecated(since = "1.3.0",
#![rustc_deprecated(since = "1.3.0",
reason = "use the external `simd` crate instead")]

#![allow(non_camel_case_types)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}

/// Converts a reference to A into a slice of length 1 (without copying).
#[unstable(feature = "ref_slice", issue = "27774")]
#[deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")]
#[rustc_deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")]
pub fn ref_slice<A>(s: &A) -> &[A] {
unsafe {
from_raw_parts(s, 1)
Expand All @@ -1432,7 +1432,7 @@ pub fn ref_slice<A>(s: &A) -> &[A] {

/// Converts a reference to A into a slice of length 1 (without copying).
#[unstable(feature = "ref_slice", issue = "27774")]
#[deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")]
#[rustc_deprecated(since = "1.5.0", reason = "unclear whether belongs in libstd")]
pub fn mut_ref_slice<A>(s: &mut A) -> &mut [A] {
unsafe {
from_raw_parts_mut(s, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ impl<'a> DoubleEndedIterator for Lines<'a> {

/// Created with the method `.lines_any()`.
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")]
#[rustc_deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")]
#[derive(Clone)]
#[allow(deprecated)]
pub struct LinesAny<'a>(Lines<'a>);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
// Emit errors for non-staged-api crates.
for attr in attrs {
let tag = attr.name();
if tag == "unstable" || tag == "stable" || tag == "deprecated" {
if tag == "unstable" || tag == "stable" || tag == "rustc_deprecated" {
attr::mark_used(attr);
self.tcx.sess.span_err(attr.span(), "stability attributes may not be used \
outside of the standard library");
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,10 @@ impl LateLintPass for MissingDebugImplementations {
declare_lint! {
DEPRECATED,
Warn,
"detects use of #[deprecated] items"
"detects use of #[rustc_deprecated] items"
}

/// Checks for use of items with `#[deprecated]` attributes
/// Checks for use of items with `#[rustc_deprecated]` attributes
#[derive(Copy, Clone)]
pub struct Stability;

Expand Down
2 changes: 2 additions & 0 deletions src/librustc_unicode/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![no_std]

#![cfg_attr(stage0, feature(rustc_attrs))]
#![cfg_attr(stage0, allow(unused_attributes))]
#![feature(core_char_ext)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
Expand Down
9 changes: 5 additions & 4 deletions src/librustc_unicode/u_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn is_utf16(v: &[u16]) -> bool {

/// An iterator that decodes UTF-16 encoded codepoints from a vector
/// of `u16`s.
#[deprecated(since = "1.4.0", reason = "renamed to `char::DecodeUtf16`")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to `char::DecodeUtf16`")]
#[unstable(feature = "decode_utf16", reason = "not exposed in std", issue = "27830")]
#[allow(deprecated)]
#[derive(Clone)]
Expand All @@ -138,7 +138,8 @@ pub struct Utf16Items<'a> {
}

/// The possibilities for values decoded from a `u16` stream.
#[deprecated(since = "1.4.0", reason = "`char::DecodeUtf16` uses `Result<char, u16>` instead")]
#[rustc_deprecated(since = "1.4.0",
reason = "`char::DecodeUtf16` uses `Result<char, u16>` instead")]
#[unstable(feature = "decode_utf16", reason = "not exposed in std", issue = "27830")]
#[allow(deprecated)]
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
Expand All @@ -162,7 +163,7 @@ impl Utf16Item {
}
}

#[deprecated(since = "1.4.0", reason = "use `char::DecodeUtf16` instead")]
#[rustc_deprecated(since = "1.4.0", reason = "use `char::DecodeUtf16` instead")]
#[unstable(feature = "decode_utf16", reason = "not exposed in std", issue = "27830")]
#[allow(deprecated)]
impl<'a> Iterator for Utf16Items<'a> {
Expand Down Expand Up @@ -210,7 +211,7 @@ impl<'a> Iterator for Utf16Items<'a> {
/// LoneSurrogate(0xD834)]);
/// }
/// ```
#[deprecated(since = "1.4.0", reason = "renamed to `char::decode_utf16`")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to `char::decode_utf16`")]
#[unstable(feature = "decode_utf16", reason = "not exposed in std", issue = "27830")]
#[allow(deprecated)]
pub fn utf16_items<'a>(v: &'a [u16]) -> Utf16Items<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/dynamic_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
reason = "API has not been scrutinized and is highly likely to \
either disappear or change",
issue = "27810")]
#![deprecated(since = "1.5.0", reason = "replaced with crates.io crates")]
#![rustc_deprecated(since = "1.5.0", reason = "replaced with crates.io crates")]
#![allow(missing_docs)]
#![allow(deprecated)]

Expand Down
4 changes: 2 additions & 2 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl CString {
/// using the pointer.
#[unstable(feature = "cstr_memory2", reason = "recently added",
issue = "27769")]
#[deprecated(since = "1.4.0", reason = "renamed to from_raw")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to from_raw")]
pub unsafe fn from_ptr(ptr: *const c_char) -> CString {
CString::from_raw(ptr as *mut _)
}
Expand All @@ -240,7 +240,7 @@ impl CString {
/// Failure to call `from_raw` will lead to a memory leak.
#[unstable(feature = "cstr_memory2", reason = "recently added",
issue = "27769")]
#[deprecated(since = "1.4.0", reason = "renamed to into_raw")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to into_raw")]
pub fn into_ptr(self) -> *const c_char {
self.into_raw() as *const _
}
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
/// # Ok(())
/// # }
/// ```
#[deprecated(since = "1.1.0",
#[rustc_deprecated(since = "1.1.0",
reason = "replaced with std::os::unix::fs::symlink and \
std::os::windows::fs::{symlink_file, symlink_dir}")]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1176,7 +1176,7 @@ impl Iterator for WalkDir {
change and some methods may be removed. For stable code, \
see the std::fs::metadata function.",
issue = "27725")]
#[deprecated(since = "1.5.0", reason = "replaced with inherent methods")]
#[rustc_deprecated(since = "1.5.0", reason = "replaced with inherent methods")]
pub trait PathExt {
/// Gets information on the file, directory, etc at this path.
///
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@
#![cfg_attr(stage0, allow(unused_attributes))]
#![cfg_attr(stage0, allow(improper_ctypes))]

#![cfg_attr(stage0, feature(rustc_attrs))]
#![cfg_attr(stage0, allow(unused_attributes))]
#![feature(alloc)]
#![feature(allow_internal_unstable)]
#![feature(asm)]
Expand Down
Loading

0 comments on commit a613059

Please sign in to comment.