Skip to content

Commit 7d8d06f

Browse files
committed
Remove deprecated functionality
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.
1 parent 470118f commit 7d8d06f

File tree

239 files changed

+1104
-7460
lines changed

Some content is hidden

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

239 files changed

+1104
-7460
lines changed

Diff for: mk/crates.mk

+6-10
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
################################################################################
5151

5252
TARGET_CRATES := libc std flate arena term \
53-
serialize getopts collections test time rand \
53+
serialize getopts collections test rand \
5454
log regex graphviz core rbml alloc \
5555
unicode
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5757
rustc_trans rustc_back rustc_llvm
58-
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
58+
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
5959
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
6060
TOOLS := compiletest rustdoc rustc
6161

@@ -75,11 +75,11 @@ DEPS_rustc_typeck := rustc syntax
7575
DEPS_rustc_borrowck := rustc log graphviz syntax
7676
DEPS_rustc_resolve := rustc log syntax
7777
DEPS_rustc := syntax flate arena serialize getopts rbml \
78-
time log graphviz rustc_llvm rustc_back
78+
log graphviz rustc_llvm rustc_back
7979
DEPS_rustc_llvm := native:rustllvm libc std
8080
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8181
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
82-
test time
82+
test
8383
DEPS_flate := std native:miniz
8484
DEPS_arena := std
8585
DEPS_graphviz := std
@@ -90,12 +90,10 @@ DEPS_term := std log
9090
DEPS_getopts := std
9191
DEPS_collections := core alloc unicode
9292
DEPS_num := std
93-
DEPS_test := std getopts serialize rbml term time regex native:rust_test_helpers
94-
DEPS_time := std serialize
93+
DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers
9594
DEPS_rand := core
9695
DEPS_log := std regex
9796
DEPS_regex := std
98-
DEPS_regex_macros = rustc syntax std regex
9997
DEPS_fmt_macros = std
10098

10199
TOOL_DEPS_compiletest := test getopts
@@ -124,10 +122,8 @@ DOC_CRATES := $(filter-out rustc, \
124122
$(filter-out rustc_driver, \
125123
$(filter-out log, \
126124
$(filter-out regex, \
127-
$(filter-out regex_macros, \
128125
$(filter-out getopts, \
129-
$(filter-out time, \
130-
$(filter-out syntax, $(CRATES)))))))))))))
126+
$(filter-out syntax, $(CRATES)))))))))))
131127
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
132128
rustc_typeck rustc_driver syntax
133129

Diff for: mk/grammar.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
3737
check-build-lexer-verifier: $(BG)verify
3838

3939
ifeq ($(NO_REBUILD),)
40-
VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
40+
VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc
4141
else
4242
VERIFY_DEPS :=
4343
endif

Diff for: mk/tests.mk

-28
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,6 @@ TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
373373
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
374374
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
375375

376-
# The regex crate depends on the regex_macros crate during testing, but it
377-
# notably depend on the *host* regex_macros crate, not the target version.
378-
# Additionally, this is not a dependency in stage1, only in stage2.
379-
ifeq ($(4),regex)
380-
ifneq ($(1),1)
381-
TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
382-
endif
383-
endif
384-
385376
else
386377
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
387378
endif
@@ -843,27 +834,8 @@ else
843834
CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
844835
endif
845836

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

868840
ifeq ($(2),$$(CFG_BUILD))
869841
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))

Diff for: src/compiletest/compiletest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern crate regex;
2222
use std::os;
2323
use std::io;
2424
use std::io::fs;
25-
use std::str::{FromStr, from_str};
25+
use std::str::FromStr;
2626
use std::thunk::Thunk;
2727
use getopts::{optopt, optflag, reqopt};
2828
use common::Config;

Diff for: src/doc/reference.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1478,19 +1478,19 @@ Constants should in general be preferred over statics, unless large amounts of
14781478
data are being stored, or single-address and mutability properties are required.
14791479

14801480
```
1481-
use std::sync::atomic;
1481+
use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_UINT_INIT};;
14821482
14831483
// Note that ATOMIC_UINT_INIT is a *const*, but it may be used to initialize a
14841484
// static. This static can be modified, so it is not placed in read-only memory.
1485-
static COUNTER: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT;
1485+
static COUNTER: AtomicUint = ATOMIC_UINT_INIT;
14861486
14871487
// This table is a candidate to be placed in read-only memory.
14881488
static TABLE: &'static [uint] = &[1, 2, 3, /* ... */];
14891489
14901490
for slot in TABLE.iter() {
14911491
println!("{}", slot);
14921492
}
1493-
COUNTER.fetch_add(1, atomic::SeqCst);
1493+
COUNTER.fetch_add(1, Ordering::SeqCst);
14941494
```
14951495

14961496
#### Mutable statics

Diff for: src/grammar/verify.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ extern crate regex;
1919
#[phase(link, plugin)]
2020
extern crate log;
2121

22-
#[phase(plugin)] extern crate regex_macros;
23-
2422
use std::collections::HashMap;
2523
use std::io::File;
24+
use regex::Regex;
2625

2726
use syntax::parse;
2827
use syntax::parse::lexer;
@@ -168,9 +167,9 @@ fn count(lit: &str) -> uint {
168167
}
169168

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

175174
let m = re.captures(s).expect(format!("The regex didn't match {}", s).as_slice());
176175
let start = m.name("start").unwrap_or("");

Diff for: src/liballoc/arc.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,9 @@ mod tests {
600600
use std::ops::Drop;
601601
use std::option::Option;
602602
use std::option::Option::{Some, None};
603-
use std::str::Str;
604603
use std::sync::atomic;
605604
use std::sync::atomic::Ordering::{Acquire, SeqCst};
606-
use std::task;
607-
use std::kinds::Send;
605+
use std::thread::Thread;
608606
use std::vec::Vec;
609607
use super::{Arc, Weak, weak_count, strong_count};
610608
use std::sync::Mutex;
@@ -631,7 +629,7 @@ mod tests {
631629

632630
let (tx, rx) = channel();
633631

634-
task::spawn(move || {
632+
let _t = Thread::spawn(move || {
635633
let arc_v: Arc<Vec<int>> = rx.recv().unwrap();
636634
assert_eq!((*arc_v)[3], 4);
637635
});

Diff for: src/liballoc/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ extern crate libc;
7777
#[cfg(test)] #[phase(plugin, link)] extern crate std;
7878
#[cfg(test)] #[phase(plugin, link)] extern crate log;
7979

80-
// The deprecated name of the boxed module
81-
82-
#[deprecated = "use boxed instead"]
83-
#[cfg(not(test))]
84-
pub use boxed as owned;
85-
8680
// Heaps provided for low-level allocation strategies
8781

8882
pub mod heap;

Diff for: src/libcollections/bench.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
6868
{
6969
// setup
7070
let mut rng = rand::weak_rng();
71-
let mut keys = Vec::from_fn(n, |_| rng.gen::<uint>() % n);
71+
let mut keys = range(0, n).map(|_| rng.gen::<uint>() % n)
72+
.collect::<Vec<_>>();
7273

7374
for k in keys.iter() {
7475
insert(map, *k);

Diff for: src/libcollections/bit.rs

+3-26
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,6 @@ impl Bitv {
685685
).collect()
686686
}
687687

688-
/// Deprecated: Use `iter().collect()`.
689-
#[deprecated = "Use `iter().collect()`"]
690-
pub fn to_bools(&self) -> Vec<bool> {
691-
self.iter().collect()
692-
}
693-
694688
/// Compares a `Bitv` to a slice of `bool`s.
695689
/// Both the `Bitv` and slice must have the same length.
696690
///
@@ -935,18 +929,6 @@ impl Bitv {
935929
}
936930
}
937931

938-
/// Deprecated: Now a static method on Bitv.
939-
#[deprecated = "Now a static method on Bitv"]
940-
pub fn from_bytes(bytes: &[u8]) -> Bitv {
941-
Bitv::from_bytes(bytes)
942-
}
943-
944-
/// Deprecated: Now a static method on Bitv.
945-
#[deprecated = "Now a static method on Bitv"]
946-
pub fn from_fn<F>(len: uint, f: F) -> Bitv where F: FnMut(uint) -> bool {
947-
Bitv::from_fn(len, f)
948-
}
949-
950932
#[stable]
951933
impl Default for Bitv {
952934
#[inline]
@@ -1907,14 +1889,9 @@ impl<'a> Iterator for SymmetricDifference<'a> {
19071889
#[cfg(test)]
19081890
mod tests {
19091891
use prelude::*;
1910-
use core::iter::range_step;
19111892
use core::u32;
1912-
use std::rand;
1913-
use std::rand::Rng;
1914-
use test::{Bencher, black_box};
19151893

1916-
use super::{Bitv, BitvSet, from_fn, from_bytes};
1917-
use bitv;
1894+
use super::Bitv;
19181895

19191896
#[test]
19201897
fn test_to_str() {
@@ -1928,7 +1905,7 @@ mod tests {
19281905
#[test]
19291906
fn test_0_elements() {
19301907
let act = Bitv::new();
1931-
let exp = Vec::from_elem(0u, false);
1908+
let exp = Vec::new();
19321909
assert!(act.eq_vec(exp.as_slice()));
19331910
assert!(act.none() && act.all());
19341911
}
@@ -2318,7 +2295,7 @@ mod tests {
23182295

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

2321-
let long = Vec::from_fn(10000, |i| i % 2 == 0);
2298+
let long = range(0, 10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
23222299
let bitv: Bitv = long.iter().map(|n| *n).collect();
23232300
assert_eq!(bitv.iter().collect::<Vec<bool>>(), long)
23242301
}

Diff for: src/libcollections/btree/map.rs

+2-26
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
187187
for _ in mem::replace(self, BTreeMap::with_b(b)).into_iter() {};
188188
}
189189

190-
/// Deprecated: renamed to `get`.
191-
#[deprecated = "renamed to `get`"]
192-
pub fn find(&self, key: &K) -> Option<&V> {
193-
self.get(key)
194-
}
195-
196190
// Searching in a B-Tree is pretty straightforward.
197191
//
198192
// Start at the root. Try to find the key in the current node. If we find it, return it.
@@ -253,12 +247,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
253247
self.get(key).is_some()
254248
}
255249

256-
/// Deprecated: renamed to `get_mut`.
257-
#[deprecated = "renamed to `get_mut`"]
258-
pub fn find_mut(&mut self, key: &K) -> Option<&mut V> {
259-
self.get_mut(key)
260-
}
261-
262250
/// Returns a mutable reference to the value corresponding to the key.
263251
///
264252
/// The key may be any borrowed form of the map's key type, but the ordering
@@ -297,12 +285,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
297285
}
298286
}
299287

300-
/// Deprecated: renamed to `insert`.
301-
#[deprecated = "renamed to `insert`"]
302-
pub fn swap(&mut self, key: K, value: V) -> Option<V> {
303-
self.insert(key, value)
304-
}
305-
306288
// Insertion in a B-Tree is a bit complicated.
307289
//
308290
// First we do the same kind of search described in `find`. But we need to maintain a stack of
@@ -438,12 +420,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
438420
// the underflow handling process on the parent. If merging merges the last two children
439421
// of the root, then we replace the root with the merged node.
440422

441-
/// Deprecated: renamed to `remove`.
442-
#[deprecated = "renamed to `remove`"]
443-
pub fn pop(&mut self, key: &K) -> Option<V> {
444-
self.remove(key)
445-
}
446-
447423
/// Removes a key from the map, returning the value at the key if the key
448424
/// was previously in the map.
449425
///
@@ -1506,7 +1482,7 @@ mod test {
15061482
let size = 10000u;
15071483

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

15111487
{
15121488
let mut iter = map.iter();
@@ -1545,7 +1521,7 @@ mod test {
15451521
let size = 10000u;
15461522

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

15501526
{
15511527
let mut iter = map.iter().rev();

0 commit comments

Comments
 (0)