Skip to content

Commit 5d28b88

Browse files
committed
---
yaml --- r: 151487 b: refs/heads/try2 c: 5200215 h: refs/heads/master i: 151485: b87d0fe 151483: 4c7d93b 151479: 5fb490d 151471: 158be28 151455: 4bda6a1 151423: 8ae3640 v: v3
1 parent c6b26ad commit 5d28b88

File tree

173 files changed

+2662
-2419
lines changed

Some content is hidden

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

173 files changed

+2662
-2419
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f83d4f060a49b3069db5bd265b331db2a50df0e1
8+
refs/heads/try2: 52002154c77377cff8a98dd5dc9467a3613caee7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
5454
workcache url log regex graphviz core
55-
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros
55+
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
5656
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5757
TOOLS := compiletest rustdoc rustc
5858

@@ -61,7 +61,7 @@ DEPS_std := core libc native:rustrt native:compiler-rt native:backtrace
6161
DEPS_green := std rand native:context_switch
6262
DEPS_rustuv := std native:uv native:uv_support
6363
DEPS_native := std
64-
DEPS_syntax := std term serialize collections log
64+
DEPS_syntax := std term serialize collections log fmt_macros
6565
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
6666
collections time log
6767
DEPS_rustdoc := rustc native:hoedown serialize sync getopts collections \
@@ -88,6 +88,7 @@ DEPS_workcache := std serialize collections log
8888
DEPS_log := std sync
8989
DEPS_regex := std collections
9090
DEPS_regex_macros = syntax std regex
91+
DEPS_fmt_macros = std
9192

9293
TOOL_DEPS_compiletest := test green rustuv getopts
9394
TOOL_DEPS_rustdoc := rustdoc native

branches/try2/mk/prepare.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
106106
prepare-host-dirs-$(4)
107107
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
108108
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
109-
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1))),),)
109+
$$(if $$(findstring 1,$$(ONLY_RLIB_$(1))),,\
110+
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1)))),),)
110111
endef
111112

112113

@@ -133,7 +134,8 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
133134
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
134135
$$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR))\
135136
$$(foreach crate,$$(TARGET_CRATES),\
136-
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))\
137+
$$(if $$(findstring 1, $$(ONLY_RLIB_$$(crate))),,\
138+
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate))))\
137139
$$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate))))\
138140
$$(if $$(findstring $(2),$$(CFG_HOST)),\
139141
$$(foreach crate,$$(HOST_CRATES),\

branches/try2/src/compiletest/runtest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ fn make_lib_name(config: &config, auxfile: &Path, testfile: &Path) -> Path {
997997
fn make_exe_name(config: &config, testfile: &Path) -> Path {
998998
let mut f = output_base_name(config, testfile);
999999
if !os::consts::EXE_SUFFIX.is_empty() {
1000-
match f.filename().map(|s| s + os::consts::EXE_SUFFIX.as_bytes()) {
1000+
match f.filename().map(|s| Vec::from_slice(s).append(os::consts::EXE_SUFFIX.as_bytes())) {
10011001
Some(v) => f.set_filename(v),
10021002
None => ()
10031003
}
@@ -1091,7 +1091,7 @@ fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path {
10911091

10921092
fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
10931093
let mut f = output_base_name(config, testfile);
1094-
match f.filename().map(|s| s + bytes!(".libaux")) {
1094+
match f.filename().map(|s| Vec::from_slice(s).append(bytes!(".libaux"))) {
10951095
Some(v) => f.set_filename(v),
10961096
None => ()
10971097
}
@@ -1273,7 +1273,7 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
12731273
(*p).clone()
12741274
} else {
12751275
let stem = p.filestem().unwrap();
1276-
p.with_filename(stem + bytes!("-") + suffix.as_bytes())
1276+
p.with_filename(Vec::from_slice(stem).append(bytes!("-")).append(suffix.as_bytes()))
12771277
}
12781278
}
12791279

branches/try2/src/doc/guide-container.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ Iterators offer generic conversion to containers with the `collect` adaptor:
266266

267267
~~~
268268
let xs = [0, 1, 1, 2, 3, 5, 8];
269-
let ys = xs.iter().rev().skip(1).map(|&x| x * 2).collect::<~[int]>();
270-
assert_eq!(ys, ~[10, 6, 4, 2, 2, 0]);
269+
let ys = xs.iter().rev().skip(1).map(|&x| x * 2).collect::<Vec<int>>();
270+
assert_eq!(ys, vec![10, 6, 4, 2, 2, 0]);
271271
~~~
272272

273273
The method requires a type hint for the container type, if the surrounding code
@@ -278,14 +278,14 @@ implementing the `FromIterator` trait. For example, the implementation for
278278
vectors is as follows:
279279

280280
~~~ {.ignore}
281-
impl<A> FromIterator<A> for ~[A] {
282-
pub fn from_iter<T: Iterator<A>>(iterator: &mut T) -> ~[A] {
281+
impl<T> FromIterator<T> for Vec<T> {
282+
fn from_iter<I:Iterator<A>>(mut iterator: I) -> Vec<T> {
283283
let (lower, _) = iterator.size_hint();
284-
let mut xs = with_capacity(lower);
285-
for x in iterator {
286-
xs.push(x);
284+
let mut vector = Vec::with_capacity(lower);
285+
for element in iterator {
286+
vector.push(element);
287287
}
288-
xs
288+
vector
289289
}
290290
}
291291
~~~

branches/try2/src/doc/rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ The keywords are the following strings:
208208

209209
~~~~ {.notrust .keyword}
210210
as
211-
break
211+
box break
212212
crate
213213
else enum extern
214214
false fn for
@@ -3598,18 +3598,18 @@ and the cast expression in `main`.
35983598
Within the body of an item that has type parameter declarations, the names of its type parameters are types:
35993599

36003600
~~~~
3601-
fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> ~[B] {
3601+
fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
36023602
if xs.len() == 0 {
3603-
return ~[];
3603+
return vec![];
36043604
}
36053605
let first: B = f(xs[0].clone());
3606-
let rest: ~[B] = map(f, xs.slice(1, xs.len()));
3607-
return ~[first] + rest;
3606+
let rest: Vec<B> = map(f, xs.slice(1, xs.len()));
3607+
return vec![first].append(rest.as_slice());
36083608
}
36093609
~~~~
36103610

36113611
Here, `first` has type `B`, referring to `map`'s `B` type parameter;
3612-
and `rest` has type `~[B]`, a vector type with element type `B`.
3612+
and `rest` has type `Vec<B>`, a vector type with element type `B`.
36133613

36143614
### Self types
36153615

branches/try2/src/doc/tutorial.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,8 +1588,8 @@ let mut numbers = vec![1, 2, 3];
15881588
numbers.push(4);
15891589
numbers.push(5);
15901590
1591-
// The type of a unique vector is written as `~[int]`
1592-
let more_numbers: ~[int] = numbers.move_iter().collect();
1591+
// The type of a unique vector is written as `Vec<int>`
1592+
let more_numbers: Vec<int> = numbers.move_iter().map(|i| i+1).collect();
15931593
15941594
// The original `numbers` value can no longer be used, due to move semantics.
15951595
@@ -1633,7 +1633,7 @@ view[0] = 5;
16331633
let ys: &mut [int] = &mut [1, 2, 3];
16341634
~~~
16351635

1636-
Square brackets denote indexing into a vector:
1636+
Square brackets denote indexing into a slice or fixed-size vector:
16371637

16381638
~~~~
16391639
# enum Crayon { Almond, AntiqueBrass, Apricot,
@@ -1647,7 +1647,7 @@ match crayons[0] {
16471647
}
16481648
~~~~
16491649

1650-
A vector can be destructured using pattern matching:
1650+
A slice or fixed-size vector can be destructured using pattern matching:
16511651

16521652
~~~~
16531653
let numbers: &[int] = &[1, 2, 3];
@@ -1660,9 +1660,10 @@ let score = match numbers {
16601660
~~~~
16611661

16621662
Both vectors and strings support a number of useful [methods](#methods),
1663-
defined in [`std::vec`] and [`std::str`].
1663+
defined in [`std::vec`], [`std::slice`], and [`std::str`].
16641664

16651665
[`std::vec`]: std/vec/index.html
1666+
[`std::slice`]: std/slice/index.html
16661667
[`std::str`]: std/str/index.html
16671668

16681669
# Ownership escape hatches

branches/try2/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<keyword>as</keyword>
3939
<keyword>assert</keyword>
4040
<keyword>break</keyword>
41+
<keyword>box</keyword>
4142
<keyword>const</keyword>
4243
<keyword>continue</keyword>
4344
<keyword>crate</keyword>

branches/try2/src/etc/kate/rust.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<list name="keywords">
1919
<item> as </item>
2020
<item> break </item>
21+
<item> box </item>
2122
<item> continue </item>
2223
<item> crate </item>
2324
<item> do </item>

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
2020
syn match rustFail "\<fail\(\w\)*!" contained
21-
syn keyword rustKeyword break continue
21+
syn keyword rustKeyword break box continue
2222
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite
2323
syn keyword rustKeyword for in if impl let
2424
syn keyword rustKeyword loop once priv pub

branches/try2/src/libcollections/hashmap.rs

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,8 +1617,7 @@ mod test_map {
16171617
use std::cmp::Equiv;
16181618
use std::hash::Hash;
16191619
use std::iter::{Iterator,range_inclusive,range_step_inclusive};
1620-
use std::local_data;
1621-
use std::vec;
1620+
use std::cell::RefCell;
16221621

16231622
struct KindaIntLike(int);
16241623

@@ -1657,7 +1656,7 @@ mod test_map {
16571656
assert_eq!(*m.find(&2).unwrap(), 4);
16581657
}
16591658

1660-
local_data_key!(drop_vector: vec::Vec<int>)
1659+
local_data_key!(drop_vector: RefCell<Vec<int>>)
16611660

16621661
#[deriving(Hash, Eq, TotalEq)]
16631662
struct Dropable {
@@ -1667,75 +1666,72 @@ mod test_map {
16671666

16681667
impl Dropable {
16691668
fn new(k: uint) -> Dropable {
1670-
local_data::get_mut(drop_vector,
1671-
|v| { v.unwrap().as_mut_slice()[k] += 1; });
1669+
let v = drop_vector.get().unwrap();
1670+
v.borrow_mut().as_mut_slice()[k] += 1;
16721671

16731672
Dropable { k: k }
16741673
}
16751674
}
16761675

16771676
impl Drop for Dropable {
16781677
fn drop(&mut self) {
1679-
local_data::get_mut(drop_vector, |v|
1680-
{ v.unwrap().as_mut_slice()[self.k] -= 1; });
1678+
let v = drop_vector.get().unwrap();
1679+
v.borrow_mut().as_mut_slice()[self.k] -= 1;
16811680
}
16821681
}
16831682

16841683
#[test]
16851684
fn test_drops() {
1686-
local_data::set(drop_vector, vec::Vec::from_elem(200, 0));
1685+
drop_vector.replace(Some(RefCell::new(Vec::from_elem(200, 0))));
16871686

16881687
{
16891688
let mut m = HashMap::new();
16901689

1691-
local_data::get(drop_vector, |v| {
1692-
for i in range(0u, 200) {
1693-
assert_eq!(v.unwrap().as_slice()[i], 0);
1694-
}
1695-
});
1690+
let v = drop_vector.get().unwrap();
1691+
for i in range(0u, 200) {
1692+
assert_eq!(v.borrow().as_slice()[i], 0);
1693+
}
1694+
drop(v);
16961695

16971696
for i in range(0u, 100) {
16981697
let d1 = Dropable::new(i);
16991698
let d2 = Dropable::new(i+100);
17001699
m.insert(d1, d2);
17011700
}
17021701

1703-
local_data::get(drop_vector, |v| {
1704-
for i in range(0u, 200) {
1705-
assert_eq!(v.unwrap().as_slice()[i], 1);
1706-
}
1707-
});
1702+
let v = drop_vector.get().unwrap();
1703+
for i in range(0u, 200) {
1704+
assert_eq!(v.borrow().as_slice()[i], 1);
1705+
}
1706+
drop(v);
17081707

17091708
for i in range(0u, 50) {
17101709
let k = Dropable::new(i);
17111710
let v = m.pop(&k);
17121711

17131712
assert!(v.is_some());
17141713

1715-
local_data::get(drop_vector, |v| {
1716-
assert_eq!(v.unwrap().as_slice()[i], 1);
1717-
assert_eq!(v.unwrap().as_slice()[i+100], 1);
1718-
});
1714+
let v = drop_vector.get().unwrap();
1715+
assert_eq!(v.borrow().as_slice()[i], 1);
1716+
assert_eq!(v.borrow().as_slice()[i+100], 1);
17191717
}
17201718

1721-
local_data::get(drop_vector, |v| {
1722-
for i in range(0u, 50) {
1723-
assert_eq!(v.unwrap().as_slice()[i], 0);
1724-
assert_eq!(v.unwrap().as_slice()[i+100], 0);
1725-
}
1719+
let v = drop_vector.get().unwrap();
1720+
for i in range(0u, 50) {
1721+
assert_eq!(v.borrow().as_slice()[i], 0);
1722+
assert_eq!(v.borrow().as_slice()[i+100], 0);
1723+
}
17261724

1727-
for i in range(50u, 100) {
1728-
assert_eq!(v.unwrap().as_slice()[i], 1);
1729-
assert_eq!(v.unwrap().as_slice()[i+100], 1);
1730-
}
1731-
});
1725+
for i in range(50u, 100) {
1726+
assert_eq!(v.borrow().as_slice()[i], 1);
1727+
assert_eq!(v.borrow().as_slice()[i+100], 1);
1728+
}
17321729
}
17331730

1734-
local_data::get(drop_vector, |v| {
1735-
for i in range(0u, 200) {
1736-
assert_eq!(v.unwrap().as_slice()[i], 0);
1737-
}
1738-
});
1731+
let v = drop_vector.get().unwrap();
1732+
for i in range(0u, 200) {
1733+
assert_eq!(v.borrow().as_slice()[i], 0);
1734+
}
17391735
}
17401736

17411737
#[test]

0 commit comments

Comments
 (0)