Skip to content

Commit ecb866d

Browse files
committed
---
yaml --- r: 33919 b: refs/heads/snap-stage3 c: 05e51e6 h: refs/heads/master i: 33917: 432e633 33915: 66c1c7e 33911: 6f0a97e 33903: d25277e 33887: d296eae 33855: b11ab06 33791: ee7a913 v: v3
1 parent 95c4897 commit ecb866d

File tree

450 files changed

+13512
-8911
lines changed

Some content is hidden

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

450 files changed

+13512
-8911
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5b6c1a2950ba2a8b6377a387f666b0e50c45fc4f
4+
refs/heads/snap-stage3: 05e51e6f7f4f70ede2164e8da325f60c64f79616
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/AUTHORS.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Graydon Hoare <[email protected]>
44

55
Other authors:
66

7+
78
Adam Bozanich <[email protected]>
89
Aleksander Balicki <[email protected]>
910
Alex Rønne Petersen <[email protected]>
@@ -29,6 +30,7 @@ Chris Peterson <[email protected]>
2930
Chris Pressey <[email protected]>
3031
Damian Gryski <[email protected]>
3132
Damien Grassart <[email protected]>
33+
Damien Schoof <[email protected]>
3234
Daniel Brooks <[email protected]>
3335
Daniel Luz <[email protected]>
3436
Daniel Patterson <[email protected]>
@@ -72,7 +74,7 @@ Jyun-Yan You <[email protected]>
7274
Kelly Wilson <[email protected]>
7375
Kevin Atkinson <[email protected]>
7476
Kevin Cantu <[email protected]>
75-
Lennart Kudling
77+
Lennart Kudling <[email protected]>
7678
Lindsey Kuper <[email protected]>
7779
Luca Bruno <[email protected]>
7880
Luqman Aden <[email protected]>
@@ -91,6 +93,7 @@ Orphée Lafond-Lummis <[email protected]>
9193
Patrick Walton <[email protected]>
9294
Patrik Kårlin <[email protected]>
9395
Paul Stansifer <[email protected]>
96+
Paul Woolcock <[email protected]>
9497
Peter Hull <[email protected]>
9598
Philipp Brüschweiler <[email protected]>
9699
Rafael Ávila de Espíndola <[email protected]>
@@ -102,14 +105,15 @@ Roland Tanglao <[email protected]>
102105
Roy Frostig <[email protected]>
103106
Ryan Scheel <[email protected]>
104107
Sean Stangl <[email protected]>
105-
Simon BD
108+
Simon Barber-Dueck <[email protected]>
106109
startling <[email protected]>
107110
Stefan Plantikow <[email protected]>
108111
Taras Shpot <[email protected]>
109112
Ted Horst <[email protected]>
110113
Tim Chevalier <[email protected]>
111114
112115
Tomoki Aonuma <[email protected]>
116+
Tony Young <[email protected]>
113117
Tycho Sci <[email protected]>
114118
Viktor Dahl <[email protected]>
115119
Vincent Belliard <[email protected]>

branches/snap-stage3/doc/README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
The markdown docs are only generated by make when node is installed (use
2+
`make doc`). If you don't have node installed you can generate them yourself.
3+
Unfortunately there's no real standard for markdown and all the tools work
4+
differently. pandoc is one that seems to work well.
5+
6+
To generate an html version of a doc do something like:
7+
pandoc --from=markdown --to=html --number-sections -o build/doc/rust.html doc/rust.md && git web--browse build/doc/rust.html
8+
9+
The syntax for pandoc flavored markdown can be found at:
10+
http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
11+
12+
A nice quick reference (for non-pandoc markdown) is at:
13+
http://kramdown.rubyforge.org/quickref.html

branches/snap-stage3/doc/rust.md

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
494494

495495
User-defined syntax extensions are called "macros", and they can be defined
496496
with the `macro_rules!` syntax extension. User-defined macros can currently
497-
only be invoked in expression position.
497+
be invoked as expressions, statements, or items.
498498

499499
(A `sep_token` is any token other than `*` and `+`. A `non_special_token` is
500500
any token other than a delimiter or `$`.)
@@ -510,9 +510,8 @@ For parsing reasons, delimiters must be balanced, but they are otherwise not spe
510510

511511
In the matcher, `$` _name_ `:` _designator_ matches the nonterminal in the
512512
Rust syntax named by _designator_. Valid designators are `item`, `block`,
513-
`stmt`, `pat`, `expr`, `ty`, `ident`, `path`, `tt`, `matchers`. The last two
514-
are the right-hand side and the left-hand side respectively of the `=>` in
515-
macro rules. In the transcriber, the designator is already known, and so only
513+
`stmt`, `pat`, `expr`, `ty` (type), `ident`, `path`, `matchers` (lhs of the `=>` in macro rules),
514+
`tt` (rhs of the `=>` in macro rules). In the transcriber, the designator is already known, and so only
516515
the name of a matched nonterminal comes after the dollar sign.
517516

518517
In both the matcher and transcriber, the Kleene star-like operator indicates repetition.
@@ -799,7 +798,7 @@ extern mod ruststd (name = "std"); // linking to 'std' under another name
799798
##### Use declarations
800799

801800
~~~~~~~~ {.ebnf .gram}
802-
use_decl : "use" ident [ '=' path
801+
use_decl : "pub"? "use" ident [ '=' path
803802
| "::" path_glob ] ;
804803
805804
path_glob : ident [ "::" path_glob ] ?
@@ -1104,6 +1103,27 @@ Constants are declared with the `const` keyword.
11041103
A constant item must have an expression giving its definition.
11051104
The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
11061105

1106+
Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from
1107+
those primitive types. The derived types are borrowed pointers, static arrays, tuples, and structs.
1108+
1109+
~~~~
1110+
const bit1: uint = 1 << 0;
1111+
const bit2: uint = 1 << 1;
1112+
1113+
const bits: [uint * 2] = [bit1, bit2];
1114+
const string: &str = "bitstring";
1115+
1116+
struct BitsNStrings {
1117+
mybits: [uint *2],
1118+
mystring: &str
1119+
}
1120+
1121+
const bits_n_strings: BitsNStrings = BitsNStrings {
1122+
mybits: bits,
1123+
mystring: string
1124+
};
1125+
~~~~
1126+
11071127
### Traits
11081128

11091129
A _trait_ describes a set of method types.
@@ -1175,6 +1195,9 @@ Values with a trait type can have [methods called](#method-call-expressions) on
11751195
for any method in the trait,
11761196
and can be used to instantiate type parameters that are bounded by the trait.
11771197

1198+
Trait methods may be static. Currently implementations of static methods behave like
1199+
functions declared in the implentation's module.
1200+
11781201
### Implementations
11791202

11801203
An _implementation_ is an item that implements a [trait](#traits) for a specific type.
@@ -1304,9 +1327,8 @@ Attributes may appear as any of
13041327
* An identifier followed by the equals sign '=' and a literal, providing a key/value pair
13051328
* An identifier followed by a parenthesized list of sub-attribute arguments
13061329

1307-
Attributes are applied to an entity by placing them within a hash-list
1308-
(`#[...]`) as either a prefix to the entity or as a semicolon-delimited
1309-
declaration within the entity body.
1330+
Attributes terminated by a semi-colon apply to the entity that the attribute is declared
1331+
within. Attributes that are not terminated by a semi-colon apply to the next entity.
13101332

13111333
An example of attributes:
13121334

@@ -1326,9 +1348,9 @@ mod bar {
13261348
...
13271349
}
13281350
1329-
// A documentation attribute
1330-
#[doc = "Add two numbers together."]
1331-
fn add(x: int, y: int) { x + y }
1351+
// A lint attribute used to suppress a warning/error
1352+
#[allow(non_camel_case_types)]
1353+
pub type int8_t = i8;
13321354
~~~~~~~~
13331355

13341356
> **Note:** In future versions of Rust, user-provided extensions to the compiler will be able to interpret attributes.
@@ -1341,6 +1363,8 @@ names are effectively reserved. Some significant attributes include:
13411363
* The `cfg` attribute, for conditional-compilation by build-configuration.
13421364
* The `link` attribute, for describing linkage metadata for a crate.
13431365
* The `test` attribute, for marking functions as unit tests.
1366+
* The `allow`, `warn`, `forbid`, and `deny` attributes, for controling lint checks. Lint checks supported
1367+
by the compiler can be found via `rustc -W help`.
13441368

13451369
Other attributes may be added or removed during development of the language.
13461370

@@ -1546,7 +1570,9 @@ it is automatically derferenced to make the field access possible.
15461570
### Vector expressions
15471571

15481572
~~~~~~~~{.ebnf .gram}
1549-
vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
1573+
vec_expr : '[' "mut"? vec_elems? ']'
1574+
1575+
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
15501576
~~~~~~~~
15511577

15521578
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
@@ -1558,6 +1584,7 @@ When no mutability is specified, the vector is immutable.
15581584
~~~~
15591585
[1, 2, 3, 4];
15601586
["a", "b", "c", "d"];
1587+
[0, ..128]; // vector with 128 zeros
15611588
[mut 0u8, 0u8, 0u8, 0u8];
15621589
~~~~
15631590

@@ -1889,7 +1916,7 @@ let x: int = add(1, 2);
18891916

18901917
~~~~~~~~ {.abnf .gram}
18911918
ident_list : [ ident [ ',' ident ]* ] ? ;
1892-
lambda_expr : '|' ident_list '| expr ;
1919+
lambda_expr : '|' ident_list '|' expr ;
18931920
~~~~~~~~
18941921

18951922
A _lambda expression_ (a.k.a. "anonymous function expression") defines a function and denotes it as a value,
@@ -2170,17 +2197,6 @@ When matching fields of a record,
21702197
the fields being matched are specified first,
21712198
then a placeholder (`_`) represents the remaining fields.
21722199

2173-
A pattern that's just a variable binding,
2174-
like `Nil` in the previous answer,
2175-
could either refer to an enum variant that's in scope,
2176-
or bind a new variable.
2177-
The compiler resolves this ambiguity by forbidding variable bindings that occur in ```match``` patterns from shadowing names of variants that are in scope.
2178-
For example, wherever ```List``` is in scope,
2179-
a ```match``` pattern would not be able to bind ```Nil``` as a new name.
2180-
The compiler interprets a variable pattern `x` as a binding _only_ if there is no variant named `x` in scope.
2181-
A convention you can use to avoid conflicts is simply to name variants with upper-case letters,
2182-
and local variables with lower-case letters.
2183-
21842200
~~~~
21852201
# type options = {choose: bool, size: ~str};
21862202
# type player = {player: ~str, stats: (), options: options};
@@ -2212,6 +2228,22 @@ fn main() {
22122228
}
22132229
~~~~
22142230

2231+
Patterns that bind variables default to binding to a copy of the matched value. This can be made
2232+
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
2233+
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
2234+
the new binding using ```move```.
2235+
2236+
A pattern that's just an identifier,
2237+
like `Nil` in the previous answer,
2238+
could either refer to an enum variant that's in scope,
2239+
or bind a new variable.
2240+
The compiler resolves this ambiguity by forbidding variable bindings that occur in ```match``` patterns from shadowing names of variants that are in scope.
2241+
For example, wherever ```List``` is in scope,
2242+
a ```match``` pattern would not be able to bind ```Nil``` as a new name.
2243+
The compiler interprets a variable pattern `x` as a binding _only_ if there is no variant named `x` in scope.
2244+
A convention you can use to avoid conflicts is simply to name variants with upper-case letters,
2245+
and local variables with lower-case letters.
2246+
22152247
Multiple match patterns may be joined with the `|` operator. A
22162248
range of values may be specified with `..`. For example:
22172249

@@ -2694,11 +2726,12 @@ The kinds are:
26942726
structural types containing only other sendable types.
26952727
`Owned`
26962728
: Types of this kind do not contain any borrowed pointers;
2697-
this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions).
2729+
this can be a useful guarantee for code that breaks borrowing assumptions using [`unsafe` operations](#unsafe-functions).
26982730
`Copy`
26992731
: This kind includes all types that can be copied. All types with
27002732
sendable kind are copyable, as are managed boxes, managed closures,
27012733
trait types, and structural types built out of these.
2734+
Types with destructors (types that implement `Drop`) can not implement `Copy`.
27022735
_Default_
27032736
: Types with destructors, closure environments,
27042737
and various other _non-first-class_ types,

branches/snap-stage3/doc/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,7 @@ them. In the rare case where the compiler needs assistance, though, the
15401540
arguments and return types may be annotated.
15411541

15421542
~~~~
1543-
# type mygoodness = fn(~str) -> ~str; type what_the = int;
1544-
let bloop = |well, oh: mygoodness| -> what_the { fail oh(well) };
1543+
let square = |x: int| -> uint { x * x as uint };
15451544
~~~~
15461545

15471546
There are several forms of closure, each with its own role. The most
@@ -1914,7 +1913,7 @@ struct TimeBomb {
19141913
}
19151914
19161915
impl TimeBomb : Drop {
1917-
fn finalize() {
1916+
fn finalize(&self) {
19181917
for iter::repeat(self.explosivity) {
19191918
io::println("blam!");
19201919
}
@@ -2043,8 +2042,9 @@ as in this version of `print_all` that copies elements.
20432042
fn print_all<T: Printable Copy>(printable_things: ~[T]) {
20442043
let mut i = 0;
20452044
while i < printable_things.len() {
2046-
let copy_of_thing = printable_things[0];
2045+
let copy_of_thing = printable_things[i];
20472046
copy_of_thing.print();
2047+
i += 1;
20482048
}
20492049
}
20502050
~~~

branches/snap-stage3/mk/tools.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
1010

1111
# Cargo, the package manager
1212
CARGO_LIB := $(S)src/libcargo/cargo.rc
13-
CARGO_INPUTS := $(wildcard $(S)src/cargo/*rs)
13+
CARGO_INPUTS := $(wildcard $(S)src/libcargo/*rs)
1414

1515
# Rustdoc, the documentation tool
1616
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rc
17-
RUSTDOC_INPUTS := $(wildcard $(S)src/rustdoc/*.rs)
17+
RUSTDOC_INPUTS := $(wildcard $(S)src/librustdoc/*.rs)
1818

1919
# Rusti, the JIT REPL
2020
RUSTI_LIB := $(S)src/librusti/rusti.rc

branches/snap-stage3/src/compiletest/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }
22

33
impl mode : cmp::Eq {
4-
pure fn eq(other: &mode) -> bool {
5-
(*other) as int == self as int
4+
pure fn eq(&self, other: &mode) -> bool {
5+
(*other) as int == (*self) as int
66
}
7-
pure fn ne(other: &mode) -> bool { !self.eq(other) }
7+
pure fn ne(&self, other: &mode) -> bool { !(*self).eq(other) }
88
}
99

1010
type config = {

0 commit comments

Comments
 (0)