Skip to content

Commit 47c49a6

Browse files
committed
---
yaml --- r: 131070 b: refs/heads/try c: b00db68 h: refs/heads/master v: v3
1 parent 79866dd commit 47c49a6

File tree

160 files changed

+3101
-2745
lines changed

Some content is hidden

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

160 files changed

+3101
-2745
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: 9c68679f2ebd5b165694e9346e4ad96a3e32aceb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6faa4f33a42de32579e02a8d030db920d360e2b5
5-
refs/heads/try: 6c5c1ee34fd6e4e455f6691a0988fa0218f5c68c
5+
refs/heads/try: b00db6801eb084d541cfb5c2158db814afd2f49f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#
6666
# * `VERBOSE=1` - Print all commands. Use this to see what's going on.
6767
# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
68+
# * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
6869
#
6970
# * `TESTNAME=...` - Specify the name of tests to run
7071
# * `CHECK_IGNORED=1` - Run normally-ignored tests

branches/try/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ then
707707
| cut -d ' ' -f 2)
708708

709709
case $CFG_CLANG_VERSION in
710-
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* )
710+
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
711711
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
712712
if [ -z "$CC" ]
713713
then

branches/try/mk/main.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,19 @@ endif
9090
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
9191
CFG_GCCISH_CFLAGS :=
9292
CFG_GCCISH_LINK_FLAGS :=
93+
CFG_JEMALLOC_FLAGS :=
9394

9495
ifdef CFG_DISABLE_OPTIMIZE
9596
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
9697
CFG_RUSTC_FLAGS +=
98+
CFG_JEMALLOC_FLAGS += --enable-debug
9799
else
98100
# The rtopt cfg turns off runtime sanity checks
99101
CFG_RUSTC_FLAGS += -O --cfg rtopt
100102
endif
101103

104+
CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
105+
102106
ifdef CFG_DISABLE_DEBUG
103107
CFG_RUSTC_FLAGS += --cfg ndebug
104108
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG

branches/try/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1
301301
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
302302
@$$(call E, make: jemalloc)
303303
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
304-
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ \
304+
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ $(CFG_JEMALLOC_FLAGS) \
305305
--build=$(CFG_BUILD) --host=$(1) \
306306
CC="$$(CC_$(1))" \
307307
AR="$$(AR_$(1))" \

branches/try/src/doc/index.md

Lines changed: 73 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,55 @@
11
% Rust Documentation
22

3-
<!-- Completely hide the TOC and the section numbers -->
4-
<style type="text/css">
5-
#TOC { display: none; }
6-
.header-section-number { display: none; }
7-
li {list-style-type: none; }
8-
</style>
3+
Welcome to the Rust documentation! You can use the section headings above
4+
to jump to any particular section.
5+
6+
# Getting Started
7+
8+
If you haven't seen Rust at all yet, the first thing you should read is the [30
9+
minute intro](intro.html). It will give you an overview of the basic ideas of Rust
10+
at a high level.
11+
12+
Once you know you really want to learn Rust, the next step is reading [the
13+
guide](guide.html). It is a lengthy explanation of Rust, its syntax, and its
14+
concepts. Upon completing the guide, you'll be an intermediate Rust developer,
15+
and will have a good grasp of the fundamental ideas behind Rust.
16+
17+
# Community & Getting Help
18+
19+
If you need help with something, or just want to talk about Rust with others,
20+
there's a few places you can do that:
21+
22+
The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/) are the
23+
fastest way to get help.
24+
[`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) is
25+
the general discussion channel, and you'll find people willing to help you with
26+
any questions you may have.
27+
28+
There are also three specialty channels:
29+
[`#rust-gamedev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-gamedev)
30+
and
31+
[`#rust-osdev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-osdev)
32+
are for game development and operating system development, respectively.
33+
There's also
34+
[`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals), which is for discussion of the development of Rust itself.
35+
36+
You can also get help on [Stack
37+
Overflow](http://stackoverflow.com/questions/tagged/rust). Searching for your
38+
problem might reveal someone who has asked it before!
39+
40+
There is an active [subreddit](http://reddit.com/r/rust) with lots of
41+
discussion about Rust.
42+
43+
There is also a [developer forum](http://discuss.rust-lang.org/), where the
44+
development of Rust itself is discussed.
945

10-
* [A 30-minute Intro to Rust](intro.html)
11-
* [The Rust tutorial](tutorial.html) (* [PDF](tutorial.pdf))
12-
* [The Rust reference manual](rust.html) (* [PDF](rust.pdf))
1346

1447
# Guides
1548

49+
Rust Guides are in-depth looks at a particular topic that's relevant to Rust
50+
development. If you're trying to figure out how to do something, there may be
51+
a guide that can help you out:
52+
1653
* [Strings](guide-strings.html)
1754
* [Pointers](guide-pointers.html)
1855
* [References and Lifetimes](guide-lifetimes.html)
@@ -24,70 +61,43 @@ li {list-style-type: none; }
2461
* [Testing](guide-testing.html)
2562
* [Rust's Runtime](guide-runtime.html)
2663

64+
# Tools
65+
66+
Rust's still a young language, so there isn't a ton of tooling yet, but the
67+
tools we have are really nice.
68+
69+
[Cargo](http://crates.io) is Rust's package manager, and its website contains
70+
lots of good documentation.
71+
72+
[The `rustdoc` manual](rustdoc.html) contains information about Rust's
73+
documentation tool.
74+
2775
# FAQs
2876

77+
There are questions that are asked quite often, and so we've made FAQs for them:
78+
2979
* [Language Design FAQ](complement-design-faq.html)
3080
* [Language FAQ](complement-lang-faq.html)
3181
* [Project FAQ](complement-project-faq.html)
3282
* [How to submit a bug report](complement-bugreport.html)
3383

34-
# Libraries
35-
36-
* [The standard library, `std`](std/index.html)
37-
38-
<!-- force the two lists to be separate -->
39-
40-
* [The `arena` allocation library](arena/index.html)
41-
* [The `collections` library](collections/index.html)
42-
* [The `flate` compression library](flate/index.html)
43-
* [The `fourcc` four-character code library](fourcc/index.html)
44-
* [The `getopts` argument parsing library](getopts/index.html)
45-
* [The `glob` file path matching library](glob/index.html)
46-
* [The `green` M:N runtime library](green/index.html)
47-
* [The `hexfloat` library for hexadecimal floating-point literals](hexfloat/index.html)
48-
* [The `libc` bindings](libc/index.html)
49-
* [The `native` 1:1 threading runtime](native/index.html)
50-
* [The `num` arbitrary precision numerics library](num/index.html)
51-
* [The `rand` library for random numbers and distributions](rand/index.html)
52-
* [The `regex` library for regular expressions](regex/index.html)
53-
* [The `rustc` compiler](rustc/index.html)
54-
* [The `rustuv` M:N I/O library](rustuv/index.html)
55-
* [The `semver` version collation library](semver/index.html)
56-
* [The `serialize` value encoding/decoding library](serialize/index.html)
57-
* [The `sync` library for concurrency-enabled mechanisms and primitives](sync/index.html)
58-
* [The `syntax` library, the Rust parser](syntax/index.html)
59-
* [The `term` terminal-handling library](term/index.html)
60-
* [The `test` library containing the unit-testing & micro-benchmark framework](test/index.html)
61-
* [The `time` library](time/index.html)
62-
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
63-
* [The `url` library](url/index.html)
64-
* [The `log` library](log/index.html)
65-
66-
# Tooling
67-
68-
* [The `rustdoc` manual](rustdoc.html)
84+
# The standard library
85+
86+
You can find function-level documentation for the entire standard library
87+
[here](std/index.html). There's a list of crates on the left with more specific
88+
sections, or you can use the search bar at the top to search for something if
89+
you know its name.
6990

7091
# External documentation
7192

72-
*Note: While these are great resources for learning Rust, they may
73-
track a particular version of Rust that is likely not exactly the same
74-
as that for which this documentation was generated.*
93+
*Note: While these are great resources for learning Rust, they may track a
94+
particular version of Rust that is likely not exactly the same as that for
95+
which this documentation was generated.*
7596

76-
* [Rust for Rubyists] - An excellent introduction for Rust; not just for Rubyists (tracks the most recent release).
77-
* [Rust by Example] - Short examples of common tasks in Rust (tracks the master branch).
78-
* [The Rust wiki](http://github.com/rust-lang/rust/wiki)
97+
* [Rust by Example] - Short examples of common tasks in Rust (tracks the master
98+
branch).
99+
* [Rust for Rubyists] - The first community tutorial for Rust. Tracks the last
100+
stable release. Not just for Ruby programmers.
79101

80-
[Rust for Rubyists]: http://www.rustforrubyists.com/
81102
[Rust by Example]: http://rustbyexample.com/
82-
83-
# Community
84-
85-
* [Reddit](http://reddit.com/r/rust)
86-
* [Stack Overflow](http://stackoverflow.com/questions/tagged/rust)
87-
* [Developer Forum](http://discuss.rust-lang.org/)
88-
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/):
89-
* [`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - general discussion
90-
* [`#rust-gamedev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-gamedev) - game development
91-
* [`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals) - compiler and libraries
92-
* [`#rust-osdev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-osdev) - operating system development
93-
103+
[Rust for Rubyists]: http://www.rustforrubyists.com/

branches/try/src/doc/rust.md

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,17 +3290,19 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has
32903290
exactly one argument, while the pattern `C(..)` is type-correct for any enum
32913291
variant `C`, regardless of how many arguments `C` has.
32923292

3293-
Used inside a vector pattern, `..` stands for any number of elements. This
3294-
wildcard can be used at most once for a given vector, which implies that it
3295-
cannot be used to specifically match elements that are at an unknown distance
3296-
from both ends of a vector, like `[.., 42, ..]`. If followed by a variable name,
3297-
it will bind the corresponding slice to the variable. Example:
3293+
Used inside a vector pattern, `..` stands for any number of elements, when the
3294+
`advanced_slice_patterns` feature gate is turned on. This wildcard can be used
3295+
at most once for a given vector, which implies that it cannot be used to
3296+
specifically match elements that are at an unknown distance from both ends of a
3297+
vector, like `[.., 42, ..]`. If followed by a variable name, it will bind the
3298+
corresponding slice to the variable. Example:
32983299

32993300
~~~~
3301+
# #![feature(advanced_slice_patterns)]
33003302
fn is_symmetric(list: &[uint]) -> bool {
33013303
match list {
33023304
[] | [_] => true,
3303-
[x, ..inside, y] if x == y => is_symmetric(inside),
3305+
[x, inside.., y] if x == y => is_symmetric(inside),
33043306
_ => false
33053307
}
33063308
}
@@ -3564,34 +3566,36 @@ let (a, b) = p;
35643566
assert!(b != "world");
35653567
~~~~
35663568

3567-
### Vector types
3569+
### Vector, Array, and Slice types
35683570

3569-
The vector type constructor represents a homogeneous array of values of a given type.
3570-
A vector has a fixed size.
3571-
(Operations like `vec.push` operate solely on owned vectors.)
3572-
A vector type can be annotated with a _definite_ size, such as `[int, ..10]`.
3573-
Such a definite-sized vector type is a first-class type, since its size is known statically.
3574-
A vector without such a size is said to be of _indefinite_ size,
3575-
and is therefore not a _first-class_ type.
3576-
An indefinite-size vector can only be instantiated through a pointer type,
3577-
such as `&[T]` or `Vec<T>`.
3578-
The kind of a vector type depends on the kind of its element type,
3579-
as with other simple structural types.
3571+
Rust has three different types for a list of items:
35803572

3581-
Expressions producing vectors of definite size cannot be evaluated in a
3582-
context expecting a vector of indefinite size; one must copy the
3583-
definite-sized vector contents into a distinct vector of indefinite size.
3573+
* `Vec<T>`, a 'vector'
3574+
* `[T ..N]`, an 'array'
3575+
* `&[T]`, a 'slice'.
35843576

3585-
An example of a vector type and its use:
3577+
A vector is a heap-allocated list of `T`. A vector has ownership over the data
3578+
inside of it. It is also able to grow and change in size. It's important to note
3579+
that `Vec<T>` is a library type, it's not actually part of the core language.
35863580

3587-
~~~~
3588-
let v: &[int] = &[7, 5, 3];
3589-
let i: int = v[2];
3590-
assert!(i == 3);
3591-
~~~~
3581+
An array has a fixed size, and can be allocated on either the stack or the heap.
3582+
3583+
A slice is a 'view' into a vector or array. It doesn't own the data it points
3584+
to, it borrows it.
3585+
3586+
An example of each kind:
3587+
3588+
```{rust}
3589+
let vec: Vec<int> = vec![1, 2, 3];
3590+
let arr: [int, ..3] = [1, 2, 3];
3591+
let s: &[int] = vec.as_slice();
3592+
```
3593+
3594+
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
3595+
`vec!` macro is also part of the standard library, rather than the language.
35923596

3593-
All in-bounds elements of a vector are always initialized,
3594-
and access to a vector is always bounds-checked.
3597+
All in-bounds elements of vectors, arrays, and slices are always initialized,
3598+
and access to a vector, array, or slice is always bounds-checked.
35953599

35963600
### Structure types
35973601

branches/try/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ let score = match numbers {
17071707
[] => 0,
17081708
[a] => a * 10,
17091709
[a, b] => a * 6 + b * 4,
1710-
[a, b, c, ..rest] => a * 5 + b * 3 + c * 2 + rest.len() as int
1710+
[a, b, c, rest..] => a * 5 + b * 3 + c * 2 + rest.len() as int
17111711
};
17121712
~~~~
17131713

branches/try/src/etc/licenseck.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
"test/bench/shootout-k-nucleotide.rs", # BSD
4848
"test/bench/shootout-mandelbrot.rs", # BSD
4949
"test/bench/shootout-meteor.rs", # BSD
50+
"test/bench/shootout-nbody.rs", # BSD
5051
"test/bench/shootout-pidigits.rs", # BSD
5152
"test/bench/shootout-regex-dna.rs", # BSD
53+
"test/bench/shootout-reverse-complement.rs", # BSD
5254
"test/bench/shootout-threadring.rs", # BSD
5355
]
5456

branches/try/src/libcollections/vec.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,19 @@ pub struct MoveItems<T> {
16181618
iter: Items<'static, T>
16191619
}
16201620

1621+
impl<T> MoveItems<T> {
1622+
#[inline]
1623+
/// Drops all items that have not yet been moved and returns the empty vector.
1624+
pub fn unwrap(mut self) -> Vec<T> {
1625+
unsafe {
1626+
for _x in self { }
1627+
let MoveItems { allocation, cap, iter: _iter } = self;
1628+
mem::forget(self);
1629+
Vec { ptr: allocation, cap: cap, len: 0 }
1630+
}
1631+
}
1632+
}
1633+
16211634
impl<T> Iterator<T> for MoveItems<T> {
16221635
#[inline]
16231636
fn next<'a>(&'a mut self) -> Option<T> {
@@ -2016,6 +2029,18 @@ mod tests {
20162029
assert_eq!(vec.swap_remove(0), None);
20172030
}
20182031

2032+
#[test]
2033+
fn test_move_iter_unwrap() {
2034+
let mut vec: Vec<uint> = Vec::with_capacity(7);
2035+
vec.push(1);
2036+
vec.push(2);
2037+
let ptr = vec.as_ptr();
2038+
vec = vec.move_iter().unwrap();
2039+
assert_eq!(vec.as_ptr(), ptr);
2040+
assert_eq!(vec.capacity(), 7);
2041+
assert_eq!(vec.len(), 0);
2042+
}
2043+
20192044
#[bench]
20202045
fn bench_new(b: &mut Bencher) {
20212046
b.iter(|| {

branches/try/src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ pub type Iterate<'a, T> = Unfold<'a, T, IterateState<'a, T>>;
21852185
/// Creates a new iterator that produces an infinite sequence of
21862186
/// repeated applications of the given function `f`.
21872187
#[allow(visible_private_types)]
2188-
pub fn iterate<'a, T: Clone>(f: |T|: 'a -> T, seed: T) -> Iterate<'a, T> {
2188+
pub fn iterate<'a, T: Clone>(seed: T, f: |T|: 'a -> T) -> Iterate<'a, T> {
21892189
Unfold::new((f, Some(seed), true), |st| {
21902190
let &(ref mut f, ref mut val, ref mut first) = st;
21912191
if *first {

branches/try/src/libcore/ops.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
*
5656
*/
5757

58+
use kinds::Sized;
59+
5860
/**
5961
*
6062
* The `Drop` trait is used to run some code when a value goes out of scope. This
@@ -700,7 +702,7 @@ pub trait IndexMut<Index,Result> {
700702
* ```
701703
*/
702704
#[lang="deref"]
703-
pub trait Deref<Result> {
705+
pub trait Deref<Sized? Result> {
704706
/// The method called to dereference a value
705707
fn deref<'a>(&'a self) -> &'a Result;
706708
}
@@ -740,7 +742,7 @@ pub trait Deref<Result> {
740742
* ```
741743
*/
742744
#[lang="deref_mut"]
743-
pub trait DerefMut<Result>: Deref<Result> {
745+
pub trait DerefMut<Sized? Result>: Deref<Result> {
744746
/// The method called to mutably dereference a value
745747
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
746748
}

0 commit comments

Comments
 (0)