Skip to content

Commit 3f0bb99

Browse files
committed
---
yaml --- r: 125807 b: refs/heads/try c: ce20571 h: refs/heads/master i: 125805: 30f0fe7 125803: 9659b3e 125799: 9c33a74 125791: 06f5df5 v: v3
1 parent cd1d4a8 commit 3f0bb99

File tree

21 files changed

+296
-666
lines changed

21 files changed

+296
-666
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: c080d26d328d6e8bbf4b159b5c5f3cd55c86f621
5+
refs/heads/try: ce20571a55ecc7915eaaa95bfedb67d389d2899c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/dist.mk

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,19 @@ distcheck-osx: dist-osx
205205
# Unix binary installer tarballs
206206
######################################################################
207207

208-
define DEF_PREPARE_DIST_DIR
209-
210-
dist-install-dir-$(1)$(3): PREPARE_HOST=$(1)
211-
dist-install-dir-$(1)$(3): PREPARE_TARGETS=$(2)
212-
dist-install-dir-$(1)$(3): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
213-
dist-install-dir-$(1)$(3): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
214-
dist-install-dir-$(1)$(3): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
215-
dist-install-dir-$(1)$(3): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
216-
dist-install-dir-$(1)$(3): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
217-
dist-install-dir-$(1)$(3): PREPARE_CLEAN=true
218-
dist-install-dir-$(1)$(3): prepare-base-dir-$(1) docs compiler-docs
208+
define DEF_INSTALLER
209+
210+
$$(eval $$(call DEF_PREPARE,dir-$(1)))
211+
212+
dist-install-dir-$(1): PREPARE_HOST=$(1)
213+
dist-install-dir-$(1): PREPARE_TARGETS=$(1)
214+
dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
215+
dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
216+
dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
217+
dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
218+
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
219+
dist-install-dir-$(1): PREPARE_CLEAN=true
220+
dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
219221
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
220222
> tmp/dist/manifest-$(1).in
221223
$$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
@@ -227,16 +229,6 @@ dist-install-dir-$(1)$(3): prepare-base-dir-$(1) docs compiler-docs
227229
$$(Q)cp -r doc $$(PREPARE_DEST_DIR)
228230
$$(Q)$$(PREPARE_BIN_CMD) $$(S)src/etc/install.sh $$(PREPARE_DEST_DIR)
229231

230-
endef
231-
232-
define DEF_INSTALLER
233-
234-
$$(eval $$(call DEF_PREPARE,dir-$(1)))
235-
236-
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(1),))
237-
238-
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(CFG_TARGET),-with-target-libs))
239-
240232
dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
241233
@$(call E, build: $$@)
242234
$$(Q)tar -czf dist/$$(PKG_NAME)-$(1).tar.gz -C tmp/dist $$(PKG_NAME)-$(1)

branches/try/mk/install.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
17+
install: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
1818
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
1919
# Remove tmp files while we can because they may have been created under sudo
2020
$(Q)rm -R tmp/dist
2121

22-
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
22+
uninstall: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
2323
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2424
# Remove tmp files while we can because they may have been created under sudo
2525
$(Q)rm -R tmp/dist

branches/try/src/doc/guide.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,15 @@ let x = (let y = 5i); // found `let` in ident position
624624
The compiler is telling us here that it was expecting to see the beginning of
625625
an expression, and a `let` can only begin a statement, not an expression.
626626

627-
Note that assigning to an already-bound variable (e.g. `y = 5i`) is still an
628-
expression, although its value is not particularly useful. Unlike C, where an
629-
assignment evaluates to the assigned value (e.g. `5i` in the previous example),
630-
in Rust the value of an assignment is the unit type `()` (which we'll cover later).
627+
However, assigning to a variable binding is an expression:
628+
629+
```{rust}
630+
let x;
631+
let y = x = 5i;
632+
```
633+
634+
In this case, we have an assignment expression (`x = 5`) whose value is
635+
being used as part of a `let` declaration statement (`let y = ...`).
631636

632637
The second kind of statement in Rust is the **expression statement**. Its
633638
purpose is to turn any expression into a statement. In practical terms, Rust's

branches/try/src/libcollections/treemap.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -190,38 +190,33 @@ impl<K: Ord, V> TreeMap<K, V> {
190190
}
191191

192192
impl<K, V> TreeMap<K, V> {
193-
/// Return the value for which `f(key)` returns `Equal`. `f` is invoked
194-
/// with current key and guides tree navigation. That means `f` should
195-
/// be aware of natural ordering of the tree.
193+
/// Return the value for which f(key) returns Equal. f is invoked
194+
/// with current key and helps to navigate the tree
196195
///
197196
/// # Example
198197
///
199198
/// ```
200-
/// use collections::treemap::TreeMap;
199+
/// use std::ascii::StrAsciiExt;
201200
///
202-
/// fn get_headers() -> TreeMap<String, String> {
203-
/// let mut result = TreeMap::new();
204-
/// result.insert("Content-Type".to_string(), "application/xml".to_string());
205-
/// result.insert("User-Agent".to_string(), "Curl-Rust/0.1".to_string());
206-
/// result
207-
/// }
201+
/// let mut t = collections::treemap::TreeMap::new();
202+
/// t.insert("Content-Type", "application/xml");
203+
/// t.insert("User-Agent", "Curl-Rust/0.1");
208204
///
209-
/// let headers = get_headers();
210-
/// let ua_key = "User-Agent";
211-
/// let ua = headers.find_with(|k| {
212-
/// ua_key.cmp(&k.as_slice())
205+
/// let ua_key = "user-agent";
206+
/// let ua = t.find_with(|&k| {
207+
/// ua_key.cmp(&k.to_ascii_lower().as_slice())
213208
/// });
214209
///
215-
/// assert_eq!((*ua.unwrap()).as_slice(), "Curl-Rust/0.1");
210+
/// assert_eq!(*ua.unwrap(), "Curl-Rust/0.1");
216211
/// ```
217212
#[inline]
218213
pub fn find_with<'a>(&'a self, f:|&K| -> Ordering) -> Option<&'a V> {
219214
tree_find_with(&self.root, f)
220215
}
221216

222-
/// Return the value for which `f(key)` returns `Equal`. `f` is invoked
223-
/// with current key and guides tree navigation. That means `f` should
224-
/// be aware of natural ordering of the tree.
217+
/// Return the value for which f(key) returns Equal. f is invoked
218+
/// with current key and helps to navigate the tree
219+
///
225220
/// # Example
226221
///
227222
/// ```
@@ -918,9 +913,14 @@ fn split<K: Ord, V>(node: &mut Box<TreeNode<K, V>>) {
918913
}
919914
}
920915

921-
// Next 2 functions have the same convention: comparator gets
922-
// at input current key and returns search_key cmp cur_key
923-
// (i.e. search_key.cmp(&cur_key))
916+
// Next 2 functions have the same conventions
917+
//
918+
// The only difference is that non-mutable version uses loop instead
919+
// of recursion (performance considerations)
920+
// It seems to be impossible to avoid recursion with mutability
921+
//
922+
// So convention is that comparator is gets at input current key
923+
// and returns search_key cmp cur_key (i.e. search_key.cmp(cur_key))
924924
fn tree_find_with<'r, K, V>(node: &'r Option<Box<TreeNode<K, V>>>,
925925
f: |&K| -> Ordering) -> Option<&'r V> {
926926
let mut current: &'r Option<Box<TreeNode<K, V>>> = node;

branches/try/src/libcollections/trie.rs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use core::default::Default;
1717
use core::mem::zeroed;
1818
use core::mem;
1919
use core::uint;
20-
use std::hash::{Writer, Hash};
2120

2221
use {Collection, Mutable, Map, MutableMap, Set, MutableSet};
2322
use slice::{Items, MutItems};
@@ -41,15 +40,6 @@ pub struct TrieMap<T> {
4140
length: uint
4241
}
4342

44-
impl<T: PartialEq> PartialEq for TrieMap<T> {
45-
fn eq(&self, other: &TrieMap<T>) -> bool {
46-
self.len() == other.len() &&
47-
self.iter().zip(other.iter()).all(|(a, b)| a == b)
48-
}
49-
}
50-
51-
impl<T: Eq> Eq for TrieMap<T> {}
52-
5343
impl<T> Collection for TrieMap<T> {
5444
/// Return the number of elements in the map
5545
#[inline]
@@ -302,16 +292,7 @@ impl<T> Extendable<(uint, T)> for TrieMap<T> {
302292
}
303293
}
304294

305-
impl<S: Writer, T: Hash<S>> Hash<S> for TrieMap<T> {
306-
fn hash(&self, state: &mut S) {
307-
for elt in self.iter() {
308-
elt.hash(state);
309-
}
310-
}
311-
}
312-
313295
#[allow(missing_doc)]
314-
#[deriving(Hash, PartialEq, Eq)]
315296
pub struct TrieSet {
316297
map: TrieMap<()>
317298
}
@@ -680,7 +661,6 @@ mod test_map {
680661
use std::prelude::*;
681662
use std::iter::range_step;
682663
use std::uint;
683-
use std::hash;
684664

685665
use {MutableMap, Map};
686666
use super::{TrieMap, TrieNode, Internal, External, Nothing};
@@ -953,41 +933,6 @@ mod test_map {
953933
assert!(m_lower.iter().all(|(_, &x)| x == 0));
954934
assert!(m_upper.iter().all(|(_, &x)| x == 0));
955935
}
956-
957-
#[test]
958-
fn test_eq() {
959-
let mut a = TrieMap::new();
960-
let mut b = TrieMap::new();
961-
962-
assert!(a == b);
963-
assert!(a.insert(0, 5i));
964-
assert!(a != b);
965-
assert!(b.insert(0, 4i));
966-
assert!(a != b);
967-
assert!(a.insert(5, 19));
968-
assert!(a != b);
969-
assert!(!b.insert(0, 5));
970-
assert!(a != b);
971-
assert!(b.insert(5, 19));
972-
assert!(a == b);
973-
}
974-
975-
#[test]
976-
fn test_hash() {
977-
let mut x = TrieMap::new();
978-
let mut y = TrieMap::new();
979-
980-
assert!(hash::hash(&x) == hash::hash(&y));
981-
x.insert(1, 'a');
982-
x.insert(2, 'b');
983-
x.insert(3, 'c');
984-
985-
y.insert(3, 'c');
986-
y.insert(2, 'b');
987-
y.insert(1, 'a');
988-
989-
assert!(hash::hash(&x) == hash::hash(&y));
990-
}
991936
}
992937

993938
#[cfg(test)]

0 commit comments

Comments
 (0)