Skip to content

Commit 80b4427

Browse files
committed
---
yaml --- r: 142899 b: refs/heads/try2 c: 53e934c h: refs/heads/master i: 142897: 78111e8 142895: 6dae4f3 v: v3
1 parent 6e56478 commit 80b4427

File tree

422 files changed

+8799
-3976
lines changed

Some content is hidden

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

422 files changed

+8799
-3976
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: 3896d46c0a6b99ef166bdc29220ef6c85ad8bc8d
8+
refs/heads/try2: 53e934c2ab773eaf61da331893d176aa3e62230b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,39 @@ LIBRUST_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rust)
235235

236236
endef
237237

238+
# $(1) is the path for directory to match against
239+
# $(2) is the glob to use in the match
240+
# $(3) is filename (usually the target being created) to filter out from match
241+
# (i.e. filename is not out-of-date artifact from prior Rust version/build)
242+
#
243+
# Note that a common bug is to accidentally construct the glob denoted
244+
# by $(2) with a space character prefix, which invalidates the
245+
# construction $(1)$(2).
246+
define CHECK_FOR_OLD_GLOB_MATCHES_EXCEPT
247+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "Warning: there are previous" \'$(2)\' "libraries:" $$MATCHES; fi
248+
endef
249+
250+
# Same interface as above, but deletes rather than just listing the files.
251+
define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
252+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "Warning: removing previous" \'$(2)\' "libraries:" $$MATCHES; rm -v $$MATCHES ; fi
253+
endef
254+
255+
# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
256+
# than in the macros above because it needs the result of running the
257+
# `ls` command after other rules in the command list have run; the
258+
# macro-expander for $(wildcard ...) would deliver its results too
259+
# soon. (This is in contrast to the macros above, which are meant to
260+
# be run at the outset of a command list in a rule.)
261+
ifdef VERBOSE
262+
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
263+
@echo "Info: now are following matches for" '$(2)' "libraries:"
264+
@( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) || true )
265+
endef
266+
else
267+
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
268+
endef
269+
endif
270+
238271
$(foreach target,$(CFG_TARGET_TRIPLES),\
239272
$(eval $(call DEF_LIBS,$(target))))
240273

branches/try2/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ do
731731
make_dir $h/test/perf
732732
make_dir $h/test/pretty
733733
make_dir $h/test/debug-info
734+
make_dir $h/test/codegen
734735
make_dir $h/test/doc-tutorial
735736
make_dir $h/test/doc-tutorial-ffi
736737
make_dir $h/test/doc-tutorial-macros

branches/try2/doc/rust.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,14 +1417,83 @@ names are effectively reserved. Some significant attributes include:
14171417
* The `lang` attribute, for custom definitions of traits and functions that are known to the Rust compiler (see [Language items](#language-items)).
14181418
* The `link` attribute, for describing linkage metadata for a crate.
14191419
* The `test` attribute, for marking functions as unit tests.
1420-
* The `allow`, `warn`, `forbid`, and `deny` attributes, for controlling lint checks. Lint checks supported
1421-
by the compiler can be found via `rustc -W help`.
1420+
* The `allow`, `warn`, `forbid`, and `deny` attributes, for
1421+
controlling lint checks (see [Lint check attributes](#lint-check-attributes)).
14221422
* The `deriving` attribute, for automatically generating
14231423
implementations of certain traits.
14241424
* The `static_assert` attribute, for asserting that a static bool is true at compiletime
14251425

14261426
Other attributes may be added or removed during development of the language.
14271427

1428+
### Lint check attributes
1429+
1430+
A lint check names a potentially undesirable coding pattern, such as
1431+
unreachable code or omitted documentation, for the static entity to
1432+
which the attribute applies.
1433+
1434+
For any lint check `C`:
1435+
1436+
* `warn(C)` warns about violations of `C` but continues compilation,
1437+
* `deny(C)` signals an error after encountering a violation of `C`,
1438+
* `allow(C)` overrides the check for `C` so that violations will go
1439+
unreported,
1440+
* `forbid(C)` is the same as `deny(C)`, but also forbids uses of
1441+
`allow(C)` within the entity.
1442+
1443+
The lint checks supported by the compiler can be found via `rustc -W help`,
1444+
along with their default settings.
1445+
1446+
~~~{.xfail-test}
1447+
mod m1 {
1448+
// Missing documentation is ignored here
1449+
#[allow(missing_doc)]
1450+
pub fn undocumented_one() -> int { 1 }
1451+
1452+
// Missing documentation signals a warning here
1453+
#[warn(missing_doc)]
1454+
pub fn undocumented_too() -> int { 2 }
1455+
1456+
// Missing documentation signals an error here
1457+
#[deny(missing_doc)]
1458+
pub fn undocumented_end() -> int { 3 }
1459+
}
1460+
~~~
1461+
1462+
This example shows how one can use `allow` and `warn` to toggle
1463+
a particular check on and off.
1464+
1465+
~~~
1466+
#[warn(missing_doc)]
1467+
mod m2{
1468+
#[allow(missing_doc)]
1469+
mod nested {
1470+
// Missing documentation is ignored here
1471+
pub fn undocumented_one() -> int { 1 }
1472+
1473+
// Missing documentation signals a warning here,
1474+
// despite the allow above.
1475+
#[warn(missing_doc)]
1476+
pub fn undocumented_two() -> int { 2 }
1477+
}
1478+
1479+
// Missing documentation signals a warning here
1480+
pub fn undocumented_too() -> int { 3 }
1481+
}
1482+
~~~
1483+
1484+
This example shows how one can use `forbid` to disallow uses
1485+
of `allow` for that lint check.
1486+
1487+
~~~{.xfail-test}
1488+
#[forbid(missing_doc)]
1489+
mod m3 {
1490+
// Attempting to toggle warning signals an error here
1491+
#[allow(missing_doc)]
1492+
/// Returns 2.
1493+
pub fn undocumented_too() -> int { 2 }
1494+
}
1495+
~~~
1496+
14281497
### Language items
14291498

14301499
Some primitive Rust operations are defined in Rust code,

branches/try2/doc/tutorial-container.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,104 @@ println(fmt!("last: %?", it.next()));
205205
// the iterator is now fully consumed
206206
assert!(it.next().is_none());
207207
~~~
208+
209+
## Conversion
210+
211+
Iterators offer generic conversion to containers with the `collect` adaptor:
212+
213+
~~~
214+
let xs = [0, 1, 1, 2, 3, 5, 8];
215+
let ys = xs.rev_iter().skip(1).transform(|&x| x * 2).collect::<~[int]>();
216+
assert_eq!(ys, ~[10, 6, 4, 2, 2, 0]);
217+
~~~
218+
219+
The method requires a type hint for the container type, if the surrounding code
220+
does not provide sufficient information.
221+
222+
Containers can provide conversion from iterators through `collect` by
223+
implementing the `FromIterator` trait. For example, the implementation for
224+
vectors is as follows:
225+
226+
~~~
227+
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
228+
pub fn from_iterator(iterator: &mut T) -> ~[A] {
229+
let (lower, _) = iterator.size_hint();
230+
let mut xs = with_capacity(lower);
231+
for iterator.advance |x| {
232+
xs.push(x);
233+
}
234+
xs
235+
}
236+
}
237+
~~~
238+
239+
### Size hints
240+
241+
The `Iterator` trait provides a `size_hint` default method, returning a lower
242+
bound and optionally on upper bound on the length of the iterator:
243+
244+
~~~
245+
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
246+
~~~
247+
248+
The vector implementation of `FromIterator` from above uses the lower bound
249+
to pre-allocate enough space to hold the minimum number of elements the
250+
iterator will yield.
251+
252+
The default implementation is always correct, but it should be overridden if
253+
the iterator can provide better information.
254+
255+
The `ZeroStream` from earlier can provide an exact lower and upper bound:
256+
257+
~~~
258+
/// A stream of N zeroes
259+
struct ZeroStream {
260+
priv remaining: uint
261+
}
262+
263+
impl ZeroStream {
264+
fn new(n: uint) -> ZeroStream {
265+
ZeroStream { remaining: n }
266+
}
267+
268+
fn size_hint(&self) -> (uint, Option<uint>) {
269+
(self.remaining, Some(self.remaining))
270+
}
271+
}
272+
273+
impl Iterator<int> for ZeroStream {
274+
fn next(&mut self) -> Option<int> {
275+
if self.remaining == 0 {
276+
None
277+
} else {
278+
self.remaining -= 1;
279+
Some(0)
280+
}
281+
}
282+
}
283+
~~~
284+
285+
## Double-ended iterators
286+
287+
The `DoubleEndedIterator` trait represents an iterator able to yield elements
288+
from either end of a range. It inherits from the `Iterator` trait and extends
289+
it with the `next_back` function.
290+
291+
A `DoubleEndedIterator` can be flipped with the `invert` adaptor, returning
292+
another `DoubleEndedIterator` with `next` and `next_back` exchanged.
293+
294+
~~~
295+
let xs = [1, 2, 3, 4, 5, 6];
296+
let mut it = xs.iter();
297+
println(fmt!("%?", it.next())); // prints `Some(&1)`
298+
println(fmt!("%?", it.next())); // prints `Some(&2)`
299+
println(fmt!("%?", it.next_back())); // prints `Some(&6)`
300+
301+
// prints `5`, `4` and `3`
302+
for it.invert().advance |&x| {
303+
println(fmt!("%?", x))
304+
}
305+
~~~
306+
307+
The `rev_iter` and `mut_rev_iter` methods on vectors just return an inverted
308+
version of the standard immutable and mutable vector iterators.

branches/try2/man/rust.1

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
.TH RUST "1" "July 2013" "rust 0.7" "User Commands"
2+
.SH NAME
3+
rust \- a front-end to the Rust toolchain
4+
.SH SYNOPSIS
5+
.B rust
6+
[\fICOMMAND\fR] [\fIOPTIONS\fR] \fIINPUT\fR
7+
8+
.SH DESCRIPTION
9+
This tool is a front-end for the Rust language, available at
10+
<\fBhttps://www.rust-lang.org\fR>. It provides commands to
11+
run, test and package Rust programs.
12+
13+
.SH COMMANDS
14+
15+
.TP
16+
\fBbuild\fR
17+
compile rust source files
18+
.TP
19+
\fBrun\fR
20+
build an executable, and run it
21+
.TP
22+
\fBtest\fR
23+
build a test executable, and run it
24+
.TP
25+
\fBdoc\fR
26+
generate documentation from doc comments
27+
.TP
28+
\fBpkg\fR
29+
download, build, install rust packages
30+
.TP
31+
\fBsketch\fR
32+
run a rust interpreter
33+
.TP
34+
\fBhelp\fR
35+
show detailed usage of a command
36+
37+
The build, run and test commands take the same parameters
38+
as the rustc command.
39+
40+
.SS "BUILD COMMAND"
41+
42+
The \fBbuild\fR command is a shortcut for the \fBrustc\fR command line.
43+
All options will be passed to the compiler verbatim. For example, to build
44+
an optimised version:
45+
46+
$ rust build -O <filename>
47+
48+
.SS "RUN COMMAND"
49+
50+
The \fBrun\fR command is a shortcut for the \fBrustc\fR command line.
51+
All options will be passed to the compiler verbatim, and if the compilation
52+
is successful, the resultant executable will be invoked. For example, to
53+
build and run an optimised version:
54+
55+
$ rust run -O <filename>
56+
57+
.SS "TEST COMMAND"
58+
59+
The \fBtest\fR command is a shortcut for the command line:
60+
61+
$ rustc --test <filename> -o <filestem>test~ && ./<filestem>test~
62+
63+
.SS "DOC COMMAND"
64+
65+
The \fBdoc\fR command is an alias for the rustdoc program. It is equivalent to:
66+
67+
$ rustdoc [options] <cratefile>
68+
69+
.SS "PKG COMMAND"
70+
71+
The \fBpkg\fR command is an alias for the rustpkg program. It is equivalent to:
72+
73+
$ rustpkg [options] <cratefile>
74+
75+
.SS "SKETCH COMMAND"
76+
77+
The \fBsketch\fR command launches the \fBrusti\fR interactive shell.
78+
79+
.SS "HELP COMMAND"
80+
81+
The \fBhelp\fR command displays a summary of available commands (ie. this text).
82+
83+
.SH "EXAMPLES"
84+
85+
To build an executable (with a main function):
86+
$ rust build hello.rs
87+
88+
To build a library from a source file:
89+
$ rust build --lib hello-lib.rs
90+
91+
To build and run an executable:
92+
$ rust run hello.rs
93+
94+
To build an executable with unit tests and execute the tests:
95+
$ rust test hello.rs
96+
97+
To create a package
98+
99+
.SH "SEE ALSO"
100+
rustc, rustdoc, rustpkg, rusti
101+
102+
.SH "BUGS"
103+
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
104+
105+
.SH "AUTHOR"
106+
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
107+
<\fI[email protected]\fR> is the project leader.
108+
109+
.SH "COPYRIGHT"
110+
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
111+
file in the rust source distribution.

branches/try2/man/rustc.1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ Build a test harness
8686
\fB\-\-target\fR TRIPLE
8787
Target triple cpu-manufacturer-kernel[-os] to compile for (see
8888
http://sources.redhat.com/autobook/autobook/autobook_17.html
89-
for detail)
89+
for details)
9090
.TP
9191
\fB\-\-target-feature\fR TRIPLE
92-
Target-specific attributes (see llc -mattr=help for detail)
92+
Target-specific attributes (see llc -mattr=help for details)
9393
.TP
9494
\fB\-\-android-cross-path\fR PATH
9595
The path to the Android NDK
@@ -128,6 +128,9 @@ To build either with a crate (.rc) file:
128128
To build an executable with debug info (experimental):
129129
$ rustc -Z debug-info -o hello hello.rs
130130

131+
.SH "SEE ALSO"
132+
133+
rust, rustdoc, rustpkg, rusti
131134

132135
.SH "BUGS"
133136
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.

0 commit comments

Comments
 (0)