Skip to content

Commit

Permalink
Remove deprecated functionality
Browse files Browse the repository at this point in the history
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
  • Loading branch information
alexcrichton committed Jan 4, 2015
1 parent 470118f commit 7d8d06f
Show file tree
Hide file tree
Showing 239 changed files with 1,104 additions and 7,460 deletions.
16 changes: 6 additions & 10 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
################################################################################

TARGET_CRATES := libc std flate arena term \
serialize getopts collections test time rand \
serialize getopts collections test rand \
log regex graphviz core rbml alloc \
unicode
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
rustc_trans rustc_back rustc_llvm
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc

Expand All @@ -75,11 +75,11 @@ DEPS_rustc_typeck := rustc syntax
DEPS_rustc_borrowck := rustc log graphviz syntax
DEPS_rustc_resolve := rustc log syntax
DEPS_rustc := syntax flate arena serialize getopts rbml \
time log graphviz rustc_llvm rustc_back
log graphviz rustc_llvm rustc_back
DEPS_rustc_llvm := native:rustllvm libc std
DEPS_rustc_back := std syntax rustc_llvm flate log libc
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
test time
test
DEPS_flate := std native:miniz
DEPS_arena := std
DEPS_graphviz := std
Expand All @@ -90,12 +90,10 @@ DEPS_term := std log
DEPS_getopts := std
DEPS_collections := core alloc unicode
DEPS_num := std
DEPS_test := std getopts serialize rbml term time regex native:rust_test_helpers
DEPS_time := std serialize
DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers
DEPS_rand := core
DEPS_log := std regex
DEPS_regex := std
DEPS_regex_macros = rustc syntax std regex
DEPS_fmt_macros = std

TOOL_DEPS_compiletest := test getopts
Expand Down Expand Up @@ -124,10 +122,8 @@ DOC_CRATES := $(filter-out rustc, \
$(filter-out rustc_driver, \
$(filter-out log, \
$(filter-out regex, \
$(filter-out regex_macros, \
$(filter-out getopts, \
$(filter-out time, \
$(filter-out syntax, $(CRATES)))))))))))))
$(filter-out syntax, $(CRATES)))))))))))
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
rustc_typeck rustc_driver syntax

Expand Down
2 changes: 1 addition & 1 deletion mk/grammar.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
check-build-lexer-verifier: $(BG)verify

ifeq ($(NO_REBUILD),)
VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc
else
VERIFY_DEPS :=
endif
Expand Down
28 changes: 0 additions & 28 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,6 @@ TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))

# The regex crate depends on the regex_macros crate during testing, but it
# notably depend on the *host* regex_macros crate, not the target version.
# Additionally, this is not a dependency in stage1, only in stage2.
ifeq ($(4),regex)
ifneq ($(1),1)
TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
endif
endif

else
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
endif
Expand Down Expand Up @@ -843,27 +834,8 @@ else
CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
endif

# (Issues #13732, #13983, #14000) The doc for the regex crate includes
# uses of the `regex!` macro from the regex_macros crate. There is
# normally a dependence injected that makes the target's regex depend
# upon the host's regex_macros (see #13845), but that dependency
# injection is currently skipped for stage1 as a special case.
#
# Therefore, as a further special case, this conditional skips
# attempting to run the doc tests for the regex crate atop stage1,
# (since there is no regex_macros crate for the stage1 rustc to load).
#
# (Another approach for solving this would be to inject the desired
# dependence for stage1 as well, by setting things up to generate a
# regex_macros crate that was compatible with the stage1 rustc and
# thus re-enable our ability to run this test.)
ifeq (stage$(1)-crate-$(4),stage1-crate-regex)
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec:
@$$(call E, skipping doc-crate-$(4) as it uses macros and cannot run at stage$(1))
else
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
endif

ifeq ($(2),$$(CFG_BUILD))
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern crate regex;
use std::os;
use std::io;
use std::io::fs;
use std::str::{FromStr, from_str};
use std::str::FromStr;
use std::thunk::Thunk;
use getopts::{optopt, optflag, reqopt};
use common::Config;
Expand Down
6 changes: 3 additions & 3 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1478,19 +1478,19 @@ Constants should in general be preferred over statics, unless large amounts of
data are being stored, or single-address and mutability properties are required.

```
use std::sync::atomic;
use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_UINT_INIT};;
// Note that ATOMIC_UINT_INIT is a *const*, but it may be used to initialize a
// static. This static can be modified, so it is not placed in read-only memory.
static COUNTER: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT;
static COUNTER: AtomicUint = ATOMIC_UINT_INIT;
// This table is a candidate to be placed in read-only memory.
static TABLE: &'static [uint] = &[1, 2, 3, /* ... */];
for slot in TABLE.iter() {
println!("{}", slot);
}
COUNTER.fetch_add(1, atomic::SeqCst);
COUNTER.fetch_add(1, Ordering::SeqCst);
```

#### Mutable statics
Expand Down
7 changes: 3 additions & 4 deletions src/grammar/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ extern crate regex;
#[phase(link, plugin)]
extern crate log;

#[phase(plugin)] extern crate regex_macros;

use std::collections::HashMap;
use std::io::File;
use regex::Regex;

use syntax::parse;
use syntax::parse::lexer;
Expand Down Expand Up @@ -168,9 +167,9 @@ fn count(lit: &str) -> uint {
}

fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>) -> TokenAndSpan {
let re = regex!(
let re = Regex::new(
r"\[@(?P<seq>\d+),(?P<start>\d+):(?P<end>\d+)='(?P<content>.+?)',<(?P<toknum>-?\d+)>,\d+:\d+]"
);
).unwrap();

let m = re.captures(s).expect(format!("The regex didn't match {}", s).as_slice());
let start = m.name("start").unwrap_or("");
Expand Down
6 changes: 2 additions & 4 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,9 @@ mod tests {
use std::ops::Drop;
use std::option::Option;
use std::option::Option::{Some, None};
use std::str::Str;
use std::sync::atomic;
use std::sync::atomic::Ordering::{Acquire, SeqCst};
use std::task;
use std::kinds::Send;
use std::thread::Thread;
use std::vec::Vec;
use super::{Arc, Weak, weak_count, strong_count};
use std::sync::Mutex;
Expand All @@ -631,7 +629,7 @@ mod tests {

let (tx, rx) = channel();

task::spawn(move || {
let _t = Thread::spawn(move || {
let arc_v: Arc<Vec<int>> = rx.recv().unwrap();
assert_eq!((*arc_v)[3], 4);
});
Expand Down
6 changes: 0 additions & 6 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ extern crate libc;
#[cfg(test)] #[phase(plugin, link)] extern crate std;
#[cfg(test)] #[phase(plugin, link)] extern crate log;

// The deprecated name of the boxed module

#[deprecated = "use boxed instead"]
#[cfg(not(test))]
pub use boxed as owned;

// Heaps provided for low-level allocation strategies

pub mod heap;
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
{
// setup
let mut rng = rand::weak_rng();
let mut keys = Vec::from_fn(n, |_| rng.gen::<uint>() % n);
let mut keys = range(0, n).map(|_| rng.gen::<uint>() % n)
.collect::<Vec<_>>();

for k in keys.iter() {
insert(map, *k);
Expand Down
29 changes: 3 additions & 26 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,6 @@ impl Bitv {
).collect()
}

/// Deprecated: Use `iter().collect()`.
#[deprecated = "Use `iter().collect()`"]
pub fn to_bools(&self) -> Vec<bool> {
self.iter().collect()
}

/// Compares a `Bitv` to a slice of `bool`s.
/// Both the `Bitv` and slice must have the same length.
///
Expand Down Expand Up @@ -935,18 +929,6 @@ impl Bitv {
}
}

/// Deprecated: Now a static method on Bitv.
#[deprecated = "Now a static method on Bitv"]
pub fn from_bytes(bytes: &[u8]) -> Bitv {
Bitv::from_bytes(bytes)
}

/// Deprecated: Now a static method on Bitv.
#[deprecated = "Now a static method on Bitv"]
pub fn from_fn<F>(len: uint, f: F) -> Bitv where F: FnMut(uint) -> bool {
Bitv::from_fn(len, f)
}

#[stable]
impl Default for Bitv {
#[inline]
Expand Down Expand Up @@ -1907,14 +1889,9 @@ impl<'a> Iterator for SymmetricDifference<'a> {
#[cfg(test)]
mod tests {
use prelude::*;
use core::iter::range_step;
use core::u32;
use std::rand;
use std::rand::Rng;
use test::{Bencher, black_box};

use super::{Bitv, BitvSet, from_fn, from_bytes};
use bitv;
use super::Bitv;

#[test]
fn test_to_str() {
Expand All @@ -1928,7 +1905,7 @@ mod tests {
#[test]
fn test_0_elements() {
let act = Bitv::new();
let exp = Vec::from_elem(0u, false);
let exp = Vec::new();
assert!(act.eq_vec(exp.as_slice()));
assert!(act.none() && act.all());
}
Expand Down Expand Up @@ -2318,7 +2295,7 @@ mod tests {

assert_eq!(bitv.iter().collect::<Vec<bool>>(), bools);

let long = Vec::from_fn(10000, |i| i % 2 == 0);
let long = range(0, 10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
let bitv: Bitv = long.iter().map(|n| *n).collect();
assert_eq!(bitv.iter().collect::<Vec<bool>>(), long)
}
Expand Down
28 changes: 2 additions & 26 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
for _ in mem::replace(self, BTreeMap::with_b(b)).into_iter() {};
}

/// Deprecated: renamed to `get`.
#[deprecated = "renamed to `get`"]
pub fn find(&self, key: &K) -> Option<&V> {
self.get(key)
}

// Searching in a B-Tree is pretty straightforward.
//
// Start at the root. Try to find the key in the current node. If we find it, return it.
Expand Down Expand Up @@ -253,12 +247,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
self.get(key).is_some()
}

/// Deprecated: renamed to `get_mut`.
#[deprecated = "renamed to `get_mut`"]
pub fn find_mut(&mut self, key: &K) -> Option<&mut V> {
self.get_mut(key)
}

/// Returns a mutable reference to the value corresponding to the key.
///
/// The key may be any borrowed form of the map's key type, but the ordering
Expand Down Expand Up @@ -297,12 +285,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
}
}

/// Deprecated: renamed to `insert`.
#[deprecated = "renamed to `insert`"]
pub fn swap(&mut self, key: K, value: V) -> Option<V> {
self.insert(key, value)
}

// Insertion in a B-Tree is a bit complicated.
//
// First we do the same kind of search described in `find`. But we need to maintain a stack of
Expand Down Expand Up @@ -438,12 +420,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
// the underflow handling process on the parent. If merging merges the last two children
// of the root, then we replace the root with the merged node.

/// Deprecated: renamed to `remove`.
#[deprecated = "renamed to `remove`"]
pub fn pop(&mut self, key: &K) -> Option<V> {
self.remove(key)
}

/// Removes a key from the map, returning the value at the key if the key
/// was previously in the map.
///
Expand Down Expand Up @@ -1506,7 +1482,7 @@ mod test {
let size = 10000u;

// Forwards
let mut map: BTreeMap<uint, uint> = Vec::from_fn(size, |i| (i, i)).into_iter().collect();
let mut map: BTreeMap<uint, uint> = range(0, size).map(|i| (i, i)).collect();

{
let mut iter = map.iter();
Expand Down Expand Up @@ -1545,7 +1521,7 @@ mod test {
let size = 10000u;

// Forwards
let mut map: BTreeMap<uint, uint> = Vec::from_fn(size, |i| (i, i)).into_iter().collect();
let mut map: BTreeMap<uint, uint> = range(0, size).map(|i| (i, i)).collect();

{
let mut iter = map.iter().rev();
Expand Down
Loading

0 comments on commit 7d8d06f

Please sign in to comment.