Skip to content

Commit

Permalink
Deprecated attributes don't take 'feature' names and are paired with …
Browse files Browse the repository at this point in the history
…stable/unstable

Conflicts:
	src/libcore/atomic.rs
	src/libcore/finally.rs
	src/test/auxiliary/inherited_stability.rs
	src/test/auxiliary/lint_stability.rs
  • Loading branch information
brson committed Jan 23, 2015
1 parent cd6d9ea commit 9758c48
Show file tree
Hide file tree
Showing 39 changed files with 437 additions and 169 deletions.
33 changes: 6 additions & 27 deletions src/etc/featureck.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
level = "unstable"
elif "[stable(" in line:
level = "stable"
elif "[deprecated(" in line:
level = "deprecated"
else:
continue

Expand All @@ -94,12 +92,12 @@
# the same line, e.g.
# `#[unstable(feature = "foo", since = "1.0.0")]`

p = re.compile('(unstable|stable|deprecated).*feature *= *"(\w*)"')
p = re.compile('(unstable|stable).*feature *= *"(\w*)"')
m = p.search(line)
if not m is None:
feature_name = m.group(2)
since = None
if "stable" in line or "deprecated" in line:
if "stable" in line:
pp = re.compile('since *= *"([\w\.]*)"')
mm = pp.search(line)
since = m.group(1)
Expand Down Expand Up @@ -135,7 +133,7 @@
errors = True

# Merge data about both lists
# name, lang, lib, status, stable since, partially deprecated
# name, lang, lib, status, stable since

language_feature_stats = {}

Expand All @@ -145,15 +143,13 @@
lib = False
status = "unstable"
stable_since = None
partially_deprecated = False

if f[2] == "Accepted":
status = "stable"
if status == "stable":
stable_since = f[1]

language_feature_stats[name] = (name, lang, lib, status, stable_since, \
partially_deprecated)
language_feature_stats[name] = (name, lang, lib, status, stable_since)

lib_feature_stats = {}

Expand All @@ -163,11 +159,9 @@
lib = True
status = "unstable"
stable_since = None
partially_deprecated = False

is_stable = lib_features_and_level.get((name, "stable")) is not None
is_unstable = lib_features_and_level.get((name, "unstable")) is not None
is_deprecated = lib_features_and_level.get((name, "deprecated")) is not None

if is_stable and is_unstable:
print "error: feature '" + name + "' is both stable and unstable"
Expand All @@ -179,14 +173,8 @@
elif is_unstable:
status = "unstable"
stable_since = lib_features_and_level[(name, "unstable")][0]
elif is_deprecated:
status = "deprecated"

if (is_stable or is_unstable) and is_deprecated:
partially_deprecated = True

lib_feature_stats[name] = (name, lang, lib, status, stable_since, \
partially_deprecated)
lib_feature_stats[name] = (name, lang, lib, status, stable_since)

# Check for overlap in two sets
merged_stats = { }
Expand All @@ -200,25 +188,18 @@
lib_status = lib_feature_stats[name][3]
lang_stable_since = lang_feature_stats[name][4]
lib_stable_since = lib_feature_stats[name][4]
lang_partially_deprecated = lang_feature_stats[name][5]
lib_partially_deprecated = lib_feature_stats[name][5]

if lang_status != lib_status and lib_status != "deprecated":
print "error: feature '" + name + "' has lang status " + lang_status + \
" but lib status " + lib_status
errors = True

partially_deprecated = lang_partially_deprecated or lib_partially_deprecated
if lib_status == "deprecated" and lang_status != "deprecated":
partially_deprecated = True

if lang_stable_since != lib_stable_since:
print "error: feature '" + name + "' has lang stable since " + lang_stable_since + \
" but lib stable since " + lib_stable_since
errors = True

merged_stats[name] = (name, True, True, lang_status, lang_stable_since, \
partially_deprecated)
merged_stats[name] = (name, True, True, lang_status, lang_stable_since)

del language_feature_stats[name]
del lib_feature_stats[name]
Expand All @@ -244,8 +225,6 @@
"{: <8}".format(type_) + \
"{: <12}".format(s[3]) + \
"{: <8}".format(str(s[4]))
if s[5]:
line += "(partially deprecated)"
lines += [line]

lines.sort()
Expand Down
2 changes: 2 additions & 0 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#![allow(missing_docs)]
#![feature(alloc)]
#![feature(core)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, feature(collections))]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#![feature(alloc)]
#![feature(unicode)]
#![feature(hash)]
#![cfg_attr(test, feature(test))]

#[macro_use]
extern crate core;
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ pub trait SliceExt {
fn binary_search(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord;

/// Deprecated: use `binary_search` instead.
#[deprecated(feature = "oldstuff", since = "1.0.0", reason = "use binary_search instead")]
#[unstable(feature = "collections")]
#[deprecated(since = "1.0.0", reason = "use binary_search instead")]
fn binary_search_elem(&self, x: &Self::Item) -> Result<uint, uint> where Self::Item: Ord {
self.binary_search(x)
}
Expand Down
12 changes: 8 additions & 4 deletions src/libcore/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,8 @@ pub fn fence(order: Ordering) {
}
}

#[deprecated(feature = "core", since = "1.0.0",
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0",
reason = "renamed to AtomicIsize")]
#[allow(missing_docs)]
pub struct AtomicInt {
Expand All @@ -1045,7 +1046,8 @@ pub struct AtomicInt {

unsafe impl Sync for AtomicInt {}

#[deprecated(feature = "core", since = "1.0.0",
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0",
reason = "renamed to AtomicUsize")]
#[allow(missing_docs)]
pub struct AtomicUint {
Expand All @@ -1054,12 +1056,14 @@ pub struct AtomicUint {

unsafe impl Sync for AtomicUint {}

#[deprecated(feature = "core", since = "1.0.0",
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0",
reason = "use ATOMIC_ISIZE_INIT instead")]
#[allow(missing_docs, deprecated)]
pub const ATOMIC_INT_INIT: AtomicInt =
AtomicInt { v: UnsafeCell { value: 0 } };
#[deprecated(feature = "core", since = "1.0.0",
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0",
reason = "use ATOMIC_USIZE_INIT instead")]
#[allow(missing_docs, deprecated)]
pub const ATOMIC_UINT_INIT: AtomicUint =
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/finally.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
//! })
//! ```
#![deprecated(feature = "core", since = "1.0.0",
#![unstable(feature = "core")]
#![deprecated(since = "1.0.0",
reason = "It is unclear if this module is more robust than implementing \
Drop on a custom type, and this module is being removed with no \
replacement. Use a custom Drop implementation to regain existing \
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ impl SipHasher {
}

/// Returns the computed hash.
#[deprecated(feature = "oldstuff", since = "1.0.0", reason = "renamed to finish")]
#[unstable(feature = "hash")]
#[deprecated(since = "1.0.0", reason = "renamed to finish")]
pub fn result(&self) -> u64 { self.finish() }
}

Expand Down
30 changes: 20 additions & 10 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,43 +178,53 @@ impl Float for f32 {
}

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn mantissa_digits(_: Option<f32>) -> uint { MANTISSA_DIGITS }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn digits(_: Option<f32>) -> uint { DIGITS }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn epsilon() -> f32 { EPSILON }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_exp(_: Option<f32>) -> int { MIN_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_exp(_: Option<f32>) -> int { MAX_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_10_exp(_: Option<f32>) -> int { MIN_10_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_value() -> f32 { MIN_VALUE }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_pos_value(_: Option<f32>) -> f32 { MIN_POS_VALUE }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_value() -> f32 { MAX_VALUE }

/// Returns the mantissa, exponent and sign as integers.
Expand Down
30 changes: 20 additions & 10 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,43 +185,53 @@ impl Float for f64 {
}

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn digits(_: Option<f64>) -> uint { DIGITS }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn epsilon() -> f64 { EPSILON }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_exp(_: Option<f64>) -> int { MIN_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_exp(_: Option<f64>) -> int { MAX_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_value() -> f64 { MIN_VALUE }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn min_pos_value(_: Option<f64>) -> f64 { MIN_POS_VALUE }

#[inline]
#[deprecated(feature = "oldstuff", since = "1.0.0")]
#[unstable(feature = "core")]
#[deprecated(since = "1.0.0")]
fn max_value() -> f64 { MAX_VALUE }

/// Returns the mantissa, exponent and sign as integers.
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/num/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
//! alpha cycle along with the development of clearer conventions
//! around integer types.
#![deprecated(feature = "oldstuff", since = "1.0.0", reason = "replaced by isize")]
#![unstable(feature = "core")]
#![deprecated(since = "1.0.0", reason = "replaced by isize")]

#[cfg(target_pointer_width = "32")] int_module! { int, 32 }
#[cfg(target_pointer_width = "64")] int_module! { int, 64 }
Loading

0 comments on commit 9758c48

Please sign in to comment.