Skip to content

Commit 8e80e1a

Browse files
committed
---
yaml --- r: 171199 b: refs/heads/batch c: abdeefd h: refs/heads/master i: 171197: b15e718 171195: ed41259 171191: 8efec55 171183: 31e8ada 171167: 4f5eec3 171135: 45b85b6 v: v3
1 parent 0358a2f commit 8e80e1a

File tree

54 files changed

+176
-389
lines changed

Some content is hidden

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

54 files changed

+176
-389
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: ed22606c8382822efc555f72f895c560289a5c70
32+
refs/heads/batch: abdeefdbcc96e0f270a4f74892589e1e6cb9b928
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 496dc4eae7de9d14cd49511a9acfbf5f11ae6c3f
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/libcollections/bench.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use prelude::*;
1212
use std::rand;
1313
use std::rand::Rng;
14-
use test::{Bencher, black_box};
14+
use test::Bencher;
1515

1616
pub fn insert_rand_n<M, I, R>(n: uint,
1717
map: &mut M,
@@ -33,8 +33,7 @@ pub fn insert_rand_n<M, I, R>(n: uint,
3333
let k = rng.gen::<uint>() % n;
3434
insert(map, k);
3535
remove(map, k);
36-
});
37-
black_box(map);
36+
})
3837
}
3938

4039
pub fn insert_seq_n<M, I, R>(n: uint,
@@ -56,8 +55,7 @@ pub fn insert_seq_n<M, I, R>(n: uint,
5655
insert(map, i);
5756
remove(map, i);
5857
i = (i + 2) % n;
59-
});
60-
black_box(map);
58+
})
6159
}
6260

6361
pub fn find_rand_n<M, T, I, F>(n: uint,
@@ -84,7 +82,7 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
8482
b.iter(|| {
8583
let t = find(map, keys[i]);
8684
i = (i + 1) % n;
87-
black_box(t);
85+
t
8886
})
8987
}
9088

@@ -106,6 +104,6 @@ pub fn find_seq_n<M, T, I, F>(n: uint,
106104
b.iter(|| {
107105
let x = find(map, i);
108106
i = (i + 1) % n;
109-
black_box(x);
107+
x
110108
})
111109
}

branches/batch/src/libcollections/btree/map.rs

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub use self::Entry::*;
1919

2020
use core::prelude::*;
2121

22-
use core::borrow::{BorrowFrom, ToOwned};
22+
use core::borrow::BorrowFrom;
2323
use core::cmp::Ordering;
2424
use core::default::Default;
2525
use core::fmt::Show;
@@ -128,23 +128,20 @@ pub struct Values<'a, K: 'a, V: 'a> {
128128
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
129129
}
130130

131-
#[stable]
132131
/// A view into a single entry in a map, which may either be vacant or occupied.
133-
pub enum Entry<'a, Sized? Q:'a, K:'a, V:'a> {
132+
pub enum Entry<'a, K:'a, V:'a> {
134133
/// A vacant Entry
135-
Vacant(VacantEntry<'a, Q, K, V>),
134+
Vacant(VacantEntry<'a, K, V>),
136135
/// An occupied Entry
137136
Occupied(OccupiedEntry<'a, K, V>),
138137
}
139138

140-
#[stable]
141139
/// A vacant Entry.
142-
pub struct VacantEntry<'a, Sized? Q:'a, K:'a, V:'a> {
143-
key: &'a Q,
140+
pub struct VacantEntry<'a, K:'a, V:'a> {
141+
key: K,
144142
stack: stack::SearchStack<'a, K, V, node::handle::Edge, node::handle::Leaf>,
145143
}
146144

147-
#[stable]
148145
/// An occupied Entry.
149146
pub struct OccupiedEntry<'a, K:'a, V:'a> {
150147
stack: stack::SearchStack<'a, K, V, node::handle::KV, node::handle::LeafOrInternal>,
@@ -1135,56 +1132,40 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
11351132
#[stable]
11361133
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
11371134

1138-
impl<'a, Sized? Q, K: Ord, V> Entry<'a, Q, K, V> {
1139-
#[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
1140-
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
1141-
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, Q, K, V>> {
1142-
match self {
1143-
Occupied(entry) => Ok(entry.into_mut()),
1144-
Vacant(entry) => Err(entry),
1145-
}
1146-
}
1147-
}
11481135

1149-
impl<'a, Sized? Q: ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
1150-
#[stable]
1136+
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
11511137
/// Sets the value of the entry with the VacantEntry's key,
11521138
/// and returns a mutable reference to it.
1153-
pub fn insert(self, value: V) -> &'a mut V {
1154-
self.stack.insert(self.key.to_owned(), value)
1139+
pub fn set(self, value: V) -> &'a mut V {
1140+
self.stack.insert(self.key, value)
11551141
}
11561142
}
11571143

11581144
impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
1159-
#[stable]
11601145
/// Gets a reference to the value in the entry.
11611146
pub fn get(&self) -> &V {
11621147
self.stack.peek()
11631148
}
11641149

1165-
#[stable]
11661150
/// Gets a mutable reference to the value in the entry.
11671151
pub fn get_mut(&mut self) -> &mut V {
11681152
self.stack.peek_mut()
11691153
}
11701154

1171-
#[stable]
11721155
/// Converts the entry into a mutable reference to its value.
11731156
pub fn into_mut(self) -> &'a mut V {
11741157
self.stack.into_top()
11751158
}
11761159

1177-
#[stable]
11781160
/// Sets the value of the entry with the OccupiedEntry's key,
11791161
/// and returns the entry's old value.
1180-
pub fn insert(&mut self, mut value: V) -> V {
1162+
pub fn set(&mut self, mut value: V) -> V {
11811163
mem::swap(self.stack.peek_mut(), &mut value);
11821164
value
11831165
}
11841166

1185-
#[stable]
11861167
/// Takes the value of the entry out of the map, and returns it.
1187-
pub fn remove(self) -> V {
1168+
pub fn take(self) -> V {
11881169
self.stack.remove()
11891170
}
11901171
}
@@ -1371,9 +1352,9 @@ impl<K: Ord, V> BTreeMap<K, V> {
13711352
///
13721353
/// // count the number of occurrences of letters in the vec
13731354
/// for x in vec!["a","b","a","c","a","b"].iter() {
1374-
/// match count.entry(x) {
1355+
/// match count.entry(*x) {
13751356
/// Entry::Vacant(view) => {
1376-
/// view.insert(1);
1357+
/// view.set(1);
13771358
/// },
13781359
/// Entry::Occupied(mut view) => {
13791360
/// let v = view.get_mut();
@@ -1384,16 +1365,12 @@ impl<K: Ord, V> BTreeMap<K, V> {
13841365
///
13851366
/// assert_eq!(count["a"], 3u);
13861367
/// ```
1387-
/// The key must have the same ordering before or after `.to_owned()` is called.
1388-
#[stable]
1389-
pub fn entry<'a, Sized? Q>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
1390-
where Q: Ord + ToOwned<K>
1391-
{
1368+
pub fn entry<'a>(&'a mut self, mut key: K) -> Entry<'a, K, V> {
13921369
// same basic logic of `swap` and `pop`, blended together
13931370
let mut stack = stack::PartialSearchStack::new(self);
13941371
loop {
13951372
let result = stack.with(move |pusher, node| {
1396-
return match Node::search(node, key) {
1373+
return match Node::search(node, &key) {
13971374
Found(handle) => {
13981375
// Perfect match
13991376
Finished(Occupied(OccupiedEntry {
@@ -1436,7 +1413,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
14361413
#[cfg(test)]
14371414
mod test {
14381415
use prelude::*;
1439-
use std::borrow::{ToOwned, BorrowFrom};
14401416

14411417
use super::{BTreeMap, Occupied, Vacant};
14421418

@@ -1586,19 +1562,19 @@ mod test {
15861562
let mut map: BTreeMap<int, int> = xs.iter().map(|&x| x).collect();
15871563

15881564
// Existing key (insert)
1589-
match map.entry(&1) {
1565+
match map.entry(1) {
15901566
Vacant(_) => unreachable!(),
15911567
Occupied(mut view) => {
15921568
assert_eq!(view.get(), &10);
1593-
assert_eq!(view.insert(100), 10);
1569+
assert_eq!(view.set(100), 10);
15941570
}
15951571
}
15961572
assert_eq!(map.get(&1).unwrap(), &100);
15971573
assert_eq!(map.len(), 6);
15981574

15991575

16001576
// Existing key (update)
1601-
match map.entry(&2) {
1577+
match map.entry(2) {
16021578
Vacant(_) => unreachable!(),
16031579
Occupied(mut view) => {
16041580
let v = view.get_mut();
@@ -1609,21 +1585,21 @@ mod test {
16091585
assert_eq!(map.len(), 6);
16101586

16111587
// Existing key (take)
1612-
match map.entry(&3) {
1588+
match map.entry(3) {
16131589
Vacant(_) => unreachable!(),
16141590
Occupied(view) => {
1615-
assert_eq!(view.remove(), 30);
1591+
assert_eq!(view.take(), 30);
16161592
}
16171593
}
16181594
assert_eq!(map.get(&3), None);
16191595
assert_eq!(map.len(), 5);
16201596

16211597

16221598
// Inexistent key (insert)
1623-
match map.entry(&10) {
1599+
match map.entry(10) {
16241600
Occupied(_) => unreachable!(),
16251601
Vacant(view) => {
1626-
assert_eq!(*view.insert(1000), 1000);
1602+
assert_eq!(*view.set(1000), 1000);
16271603
}
16281604
}
16291605
assert_eq!(map.get(&10).unwrap(), &1000);

branches/batch/src/librustc/lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,8 +1329,8 @@ impl UnusedMut {
13291329
let ident = path1.node;
13301330
if let ast::BindByValue(ast::MutMutable) = mode {
13311331
if !token::get_ident(ident).get().starts_with("_") {
1332-
match mutables.entry(&ident.name.uint()) {
1333-
Vacant(entry) => { entry.insert(vec![id]); },
1332+
match mutables.entry(ident.name.uint()) {
1333+
Vacant(entry) => { entry.set(vec![id]); },
13341334
Occupied(mut entry) => { entry.get_mut().push(id); },
13351335
}
13361336
}
@@ -1762,7 +1762,7 @@ impl LintPass for Stability {
17621762
}
17631763
}
17641764
}
1765-
ast::ItemImpl(_, _, _, Some(ref t), _, _) => {
1765+
ast::ItemImpl(_, _, Some(ref t), _, _) => {
17661766
let id = ty::trait_ref_to_def_id(cx.tcx, t);
17671767
self.lint(cx, id, t.path.span);
17681768
}

branches/batch/src/librustc/metadata/common.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,3 @@ pub const tag_unsafety: uint = 0xb1;
259259

260260
pub const tag_associated_type_names: uint = 0xb2;
261261
pub const tag_associated_type_name: uint = 0xb3;
262-
263-
pub const tag_polarity: uint = 0xb4;

branches/batch/src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ fn dump_crates(cstore: &CStore) {
8787
fn warn_if_multiple_versions(diag: &SpanHandler, cstore: &CStore) {
8888
let mut map = FnvHashMap::new();
8989
cstore.iter_crate_data(|cnum, data| {
90-
match map.entry(&data.name()) {
91-
Vacant(entry) => { entry.insert(vec![cnum]); },
90+
match map.entry(data.name()) {
91+
Vacant(entry) => { entry.set(vec![cnum]); },
9292
Occupied(mut entry) => { entry.get_mut().push(cnum); },
9393
}
9494
});

branches/batch/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12071207
None => {}
12081208
}
12091209
}
1210-
ast::ItemImpl(unsafety, polarity, _, ref opt_trait, ref ty, ref ast_items) => {
1210+
ast::ItemImpl(unsafety, _, ref opt_trait, ref ty, ref ast_items) => {
12111211
// We need to encode information about the default methods we
12121212
// have inherited, so we drive this based on the impl structure.
12131213
let impl_items = tcx.impl_items.borrow();
@@ -1221,7 +1221,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
12211221
encode_name(rbml_w, item.ident.name);
12221222
encode_attributes(rbml_w, item.attrs[]);
12231223
encode_unsafety(rbml_w, unsafety);
1224-
encode_polarity(rbml_w, polarity);
12251224
match ty.node {
12261225
ast::TyPath(ref path, _) if path.segments.len() == 1 => {
12271226
let ident = path.segments.last().unwrap().identifier;
@@ -1705,14 +1704,6 @@ fn encode_associated_type_names(rbml_w: &mut Encoder, names: &[ast::Name]) {
17051704
rbml_w.end_tag();
17061705
}
17071706

1708-
fn encode_polarity(rbml_w: &mut Encoder, polarity: ast::ImplPolarity) {
1709-
let byte: u8 = match polarity {
1710-
ast::ImplPolarity::Positive => 0,
1711-
ast::ImplPolarity::Negative => 1,
1712-
};
1713-
rbml_w.wr_tagged_u8(tag_polarity, byte);
1714-
}
1715-
17161707
fn encode_crate_deps(rbml_w: &mut Encoder, cstore: &cstore::CStore) {
17171708
fn get_ordered_deps(cstore: &cstore::CStore) -> Vec<decoder::CrateDep> {
17181709
// Pull the cnums and name,vers,hash out of cstore
@@ -1894,7 +1885,7 @@ struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
18941885

18951886
impl<'a, 'b, 'c, 'tcx, 'v> Visitor<'v> for ImplVisitor<'a, 'b, 'c, 'tcx> {
18961887
fn visit_item(&mut self, item: &ast::Item) {
1897-
if let ast::ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node {
1888+
if let ast::ItemImpl(_, _, Some(ref trait_ref), _, _) = item.node {
18981889
let def_map = &self.ecx.tcx.def_map;
18991890
let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
19001891
let def_id = trait_def.def_id();

branches/batch/src/librustc/metadata/loader.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ use util::fs;
228228

229229
use std::c_str::ToCStr;
230230
use std::cmp;
231+
use std::collections::hash_map::Entry::{Occupied, Vacant};
231232
use std::collections::{HashMap, HashSet};
232233
use std::io::fs::PathExtensions;
233234
use std::io;
@@ -399,9 +400,10 @@ impl<'a> Context<'a> {
399400
};
400401
info!("lib candidate: {}", path.display());
401402

402-
let hash_str = hash.to_string();
403-
let slot = candidates.entry(&hash_str).get().unwrap_or_else(
404-
|vacant_entry| vacant_entry.insert((HashSet::new(), HashSet::new())));
403+
let slot = match candidates.entry(hash.to_string()) {
404+
Occupied(entry) => entry.into_mut(),
405+
Vacant(entry) => entry.set((HashSet::new(), HashSet::new())),
406+
};
405407
let (ref mut rlibs, ref mut dylibs) = *slot;
406408
if rlib {
407409
rlibs.insert(fs::realpath(path).unwrap());

branches/batch/src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr) -> P<ast::Pat> {
311311

312312
ast::ExprCall(ref callee, ref args) => {
313313
let def = tcx.def_map.borrow()[callee.id].clone();
314-
if let Vacant(entry) = tcx.def_map.borrow_mut().entry(&expr.id) {
315-
entry.insert(def);
314+
if let Vacant(entry) = tcx.def_map.borrow_mut().entry(expr.id) {
315+
entry.set(def);
316316
}
317317
let path = match def {
318318
def::DefStruct(def_id) => def_to_path(tcx, def_id),

branches/batch/src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl<'v> Visitor<'v> for LifeSeeder {
355355
ast::ItemEnum(ref enum_def, _) if allow_dead_code => {
356356
self.worklist.extend(enum_def.variants.iter().map(|variant| variant.node.id));
357357
}
358-
ast::ItemImpl(_, _, _, Some(ref _trait_ref), _, ref impl_items) => {
358+
ast::ItemImpl(_, _, Some(ref _trait_ref), _, ref impl_items) => {
359359
for impl_item in impl_items.iter() {
360360
match *impl_item {
361361
ast::MethodImplItem(ref method) => {

branches/batch/src/librustc/middle/infer/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
17121712
match tcx.map.find(parent) {
17131713
Some(node) => match node {
17141714
ast_map::NodeItem(item) => match item.node {
1715-
ast::ItemImpl(_, _, ref gen, _, _, _) => {
1715+
ast::ItemImpl(_, ref gen, _, _, _) => {
17161716
taken.push_all(gen.lifetimes.as_slice());
17171717
}
17181718
_ => ()

branches/batch/src/librustc/middle/infer/freshen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
6666
None => { }
6767
}
6868

69-
match self.freshen_map.entry(&key) {
69+
match self.freshen_map.entry(key) {
7070
Entry::Occupied(entry) => *entry.get(),
7171
Entry::Vacant(entry) => {
7272
let index = self.freshen_count;
7373
self.freshen_count += 1;
7474
let t = ty::mk_infer(self.infcx.tcx, freshener(index));
75-
entry.insert(t);
75+
entry.set(t);
7676
t
7777
}
7878
}

branches/batch/src/librustc/middle/infer/region_inference/graphviz.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
137137
let mut node_ids = FnvHashMap::new();
138138
{
139139
let mut add_node = |&mut : node| {
140-
if let Vacant(e) = node_ids.entry(&node) {
141-
e.insert(i);
140+
if let Vacant(e) = node_ids.entry(node) {
141+
e.set(i);
142142
i += 1;
143143
}
144144
};

0 commit comments

Comments
 (0)