Skip to content

Commit b951034

Browse files
committed
---
yaml --- r: 46829 b: refs/heads/auto c: 81e3702 h: refs/heads/master i: 46827: ab1cb78 v: v3
1 parent 505d808 commit b951034

File tree

888 files changed

+17550
-13925
lines changed

Some content is hidden

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

888 files changed

+17550
-13925
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 14e5a6e5f74b174399a561c68e5214d572f7a667
17+
refs/heads/auto: 81e370285f9709d133d114f405bd4f797f7dc3e9

branches/auto/AUTHORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Josh Matthews <[email protected]>
9393
Joshua Clark <[email protected]>
9494
Joshua Wise <[email protected]>
9595
Jyun-Yan You <[email protected]>
96+
Kang Seonghoon <[email protected]>
9697
Kelly Wilson <[email protected]>
9798
Kevin Atkinson <[email protected]>
9899
Kevin Cantu <[email protected]>

branches/auto/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You're not off the hook even if you just stick to documentation; code examples i
1111
Pull requests will be treated as "review requests",
1212
and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling.
1313
Changes contributed via pull request should focus on a single issue at a time, like any other.
14-
We will not look accept pull-requests that try to "sneak" unrelated changes in.
14+
We will not accept pull-requests that try to "sneak" unrelated changes in.
1515

1616
Normally, all pull requests must include regression tests (see [Note-testsuite](https://github.com/mozilla/rust/wiki/Note-testsuite)) that test your change.
1717
Occasionally, a change will be very difficult to test for.

branches/auto/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ DRIVER_CRATE := $(S)src/driver/driver.rs
267267
######################################################################
268268

269269
# FIXME: x86-ism
270-
LLVM_COMPONENTS=x86 arm ipo bitreader bitwriter linker asmparser jit mcjit \
270+
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
271271
interpreter
272272

273273
define DEF_LLVM_VARS

branches/auto/configure

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ for t in $CFG_TARGET_TRIPLES
611611
do
612612
make_dir rt/$t
613613
for i in \
614-
isaac linenoise sync test arch/i386 arch/x86_64 arch/arm \
614+
isaac linenoise sync test \
615+
arch/i386 arch/x86_64 arch/arm arch/mips \
615616
libuv libuv/src/ares libuv/src/eio libuv/src/ev
616617
do
617618
make_dir rt/$t/$i
@@ -712,7 +713,7 @@ do
712713
LLVM_BUILD_DIR=${CFG_BUILD_DIR}llvm/$t
713714
if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]
714715
then
715-
LLVM_DBG_OPTS=""
716+
LLVM_DBG_OPTS="--enable-debug-symbols --disable-optimized"
716717
# Just use LLVM straight from its build directory to
717718
# avoid 'make install' time
718719
LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug+Asserts
@@ -752,7 +753,7 @@ do
752753
then
753754
msg "configuring LLVM for $t"
754755

755-
LLVM_TARGETS="--enable-targets=x86,x86_64,arm"
756+
LLVM_TARGETS="--enable-targets=x86,x86_64,arm,mips"
756757
LLVM_BUILD="--build=$t"
757758
LLVM_HOST="--host=$t"
758759
LLVM_TARGET="--target=$t"

branches/auto/doc/rust.md

Lines changed: 56 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ the following forms:
297297
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
298298
| '0' [ [ dec_digit | '_' ] + num_suffix ?
299299
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
300-
| 'x' [ hex_digit | '-' ] + int_suffix ? ] ;
300+
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
301301
302302
num_suffix : int_suffix | float_suffix ;
303303
@@ -908,6 +908,11 @@ function defined above on `[1, 2]` will instantiate type parameter `T`
908908
with `int`, and require the closure parameter to have type
909909
`fn(int)`.
910910

911+
The type parameters can also be explicitly supplied in a trailing
912+
[path](#paths) component after the function name. This might be necessary
913+
if there is not sufficient context to determine the type parameters. For
914+
example, `sys::size_of::<u32>() == 4`.
915+
911916
Since a parameter type is opaque to the generic function, the set of
912917
operations that can be performed on it is limited. Values of parameter
913918
type can always be moved, but they can only be copied when the
@@ -1085,6 +1090,15 @@ let p = Point(10, 11);
10851090
let px: int = match p { Point(x, _) => x };
10861091
~~~~
10871092

1093+
A _unit-like struct_ is a structure without any fields, defined by leaving off the fields list entirely.
1094+
Such types will have a single value, just like the [unit value `()`](#unit-and-boolean-literals) of the unit type.
1095+
For example:
1096+
1097+
~~~~
1098+
struct Cookie;
1099+
let c = [Cookie, Cookie, Cookie, Cookie];
1100+
~~~~
1101+
10881102
### Enumerations
10891103

10901104
An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -1130,22 +1144,23 @@ Constants are declared with the `const` keyword.
11301144
A constant item must have an expression giving its definition.
11311145
The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
11321146

1133-
Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from
1134-
those primitive types. The derived types are borrowed pointers, static arrays, tuples, and structs.
1147+
Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from those primitive types.
1148+
The derived types are borrowed pointers, static arrays, tuples, and structs.
1149+
Borrowed pointers must be have the `'static` lifetime.
11351150

11361151
~~~~
11371152
const bit1: uint = 1 << 0;
11381153
const bit2: uint = 1 << 1;
11391154
11401155
const bits: [uint * 2] = [bit1, bit2];
1141-
const string: &str = "bitstring";
1156+
const string: &'static str = "bitstring";
11421157
11431158
struct BitsNStrings {
11441159
mybits: [uint *2],
1145-
mystring: &str
1160+
mystring: &'self str
11461161
}
11471162
1148-
const bits_n_strings: BitsNStrings = BitsNStrings {
1163+
const bits_n_strings: BitsNStrings<'static> = BitsNStrings {
11491164
mybits: bits,
11501165
mystring: string
11511166
};
@@ -1285,19 +1300,22 @@ An _implementation_ is an item that implements a [trait](#traits) for a specific
12851300
Implementations are defined with the keyword `impl`.
12861301

12871302
~~~~
1288-
# type Point = {x: float, y: float};
1303+
# struct Point {x: float, y: float};
12891304
# type Surface = int;
1290-
# type BoundingBox = {x: float, y: float, width: float, height: float};
1305+
# struct BoundingBox {x: float, y: float, width: float, height: float};
12911306
# trait Shape { fn draw(Surface); fn bounding_box() -> BoundingBox; }
12921307
# fn do_draw_circle(s: Surface, c: Circle) { }
12931308
1294-
type Circle = {radius: float, center: Point};
1309+
struct Circle {
1310+
radius: float,
1311+
center: Point,
1312+
}
12951313
12961314
impl Shape for Circle {
12971315
fn draw(s: Surface) { do_draw_circle(s, self); }
12981316
fn bounding_box() -> BoundingBox {
12991317
let r = self.radius;
1300-
{x: self.center.x - r, y: self.center.y - r,
1318+
BoundingBox{x: self.center.x - r, y: self.center.y - r,
13011319
width: 2.0 * r, height: 2.0 * r}
13021320
}
13031321
}
@@ -1343,7 +1361,7 @@ Functions within foreign modules are declared in the same way as other Rust func
13431361
with the exception that they may not have a body and are instead terminated by a semicolon.
13441362

13451363
~~~
1346-
# use libc::{c_char, FILE};
1364+
# use core::libc::{c_char, FILE};
13471365
# #[nolink]
13481366
13491367
extern mod c {
@@ -1590,7 +1608,8 @@ struct_expr : expr_path '{' ident ':' expr
15901608
[ ',' ident ':' expr ] *
15911609
[ ".." expr ] '}' |
15921610
expr_path '(' expr
1593-
[ ',' expr ] * ')'
1611+
[ ',' expr ] * ')' |
1612+
expr_path
15941613
~~~~~~~~
15951614

15961615
There are several forms of structure expressions.
@@ -1600,24 +1619,28 @@ providing the field values of a new instance of the structure.
16001619
A field name can be any identifier, and is separated from its value expression by a colon.
16011620
To indicate that a field is mutable, the `mut` keyword is written before its name.
16021621

1603-
A _tuple structure expression_ constists of the [path](#paths) of a [structure item](#structures),
1622+
A _tuple structure expression_ consists of the [path](#paths) of a [structure item](#structures),
16041623
followed by a parenthesized list of one or more comma-separated expressions
16051624
(in other words, the path of a structured item followed by a tuple expression).
16061625
The structure item must be a tuple structure item.
16071626

1627+
A _unit-like structure expression_ consists only of the [path](#paths) of a [structure item](#structures).
1628+
16081629
The following are examples of structure expressions:
16091630

16101631
~~~~
16111632
# struct Point { x: float, y: float }
16121633
# struct TuplePoint(float, float);
1613-
# mod game { pub struct User { name: &str, age: uint, mut score: uint } }
1614-
# use game;
1634+
# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } }
1635+
# struct Cookie; fn some_fn<T>(t: T) {}
16151636
Point {x: 10f, y: 20f};
16161637
TuplePoint(10f, 20f);
1617-
let u = game::User {name: "Joe", age: 35u, mut score: 100_000};
1638+
let u = game::User {name: "Joe", age: 35u, score: 100_000};
1639+
some_fn::<Cookie>(Cookie);
16181640
~~~~
16191641

16201642
A structure expression forms a new value of the named structure type.
1643+
Note that for a given *unit-like* structure type, this will always be the same value.
16211644

16221645
A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
16231646
The expression following `..` (the base) must be of the same structure type as the new structure type being formed.
@@ -1638,38 +1661,6 @@ rec_expr : '{' ident ':' expr
16381661
[ ".." expr ] '}'
16391662
~~~~~~~~
16401663

1641-
> **Note:** In future versions of Rust, record expressions and [record types](#record-types) will be removed.
1642-
1643-
A [_record_](#record-types) _expression_ is one or more comma-separated
1644-
name-value pairs enclosed by braces. A fieldname can be any identifier,
1645-
and is separated from its value expression by a
1646-
colon. To indicate that a field is mutable, the `mut` keyword is
1647-
written before its name.
1648-
1649-
~~~~
1650-
{x: 10f, y: 20f};
1651-
{name: "Joe", age: 35u, score: 100_000};
1652-
{ident: "X", mut count: 0u};
1653-
~~~~
1654-
1655-
The order of the fields in a record expression is significant, and
1656-
determines the type of the resulting value. `{a: u8, b: u8}` and `{b:
1657-
u8, a: u8}` are two different fields.
1658-
1659-
A record expression can terminate with the syntax `..` followed by an
1660-
expression to denote a functional update. The expression following
1661-
`..` (the base) must be of a record type that includes at least all the
1662-
fields mentioned in the record expression. A new record will be
1663-
created, of the same type as the base expression, with the given
1664-
values for the fields that were explicitly specified, and the values
1665-
in the base record for all other fields. The ordering of the fields in
1666-
such a record expression is not significant.
1667-
1668-
~~~~
1669-
let base = {x: 1, y: 2, z: 3};
1670-
{y: 0, z: 10, .. base};
1671-
~~~~
1672-
16731664
### Method-call expressions
16741665

16751666
~~~~~~~~{.ebnf .gram}
@@ -1690,7 +1681,7 @@ field_expr : expr '.' ident
16901681

16911682
A _field expression_ consists of an expression followed by a single dot and an identifier,
16921683
when not immediately followed by a parenthesized expression-list (the latter is a [method call expression](#method-call-expressions)).
1693-
A field expression denotes a field of a [structure](#structure-types) or [record](#record-types).
1684+
A field expression denotes a field of a [structure](#structure-types).
16941685

16951686
~~~~~~~~ {.field}
16961687
myrecord.myfield;
@@ -1906,8 +1897,10 @@ An example of three different swap expressions:
19061897
# let mut x = &mut [0];
19071898
# let mut a = &mut [0];
19081899
# let i = 0;
1909-
# let y = {mut z: 0};
1910-
# let b = {mut c: 0};
1900+
# struct S1 { z: int };
1901+
# struct S2 { c: int };
1902+
# let mut y = S1{z: 0};
1903+
# let mut b = S2{c: 0};
19111904
19121905
x <-> a;
19131906
x[i] <-> a[i];
@@ -2041,12 +2034,14 @@ an optional reference slot to serve as the function's output, bound to the
20412034
`lval` on the right hand side of the call. If the function eventually returns,
20422035
then the expression completes.
20432036

2044-
An example of a call expression:
2037+
Some examples of call expressions:
20452038

20462039
~~~~
20472040
# fn add(x: int, y: int) -> int { 0 }
2041+
# use core::from_str::FromStr::from_str;
20482042
20492043
let x: int = add(1, 2);
2044+
let pi = from_str::<f32>("3.14");
20502045
~~~~
20512046

20522047
### Lambda expressions
@@ -2329,42 +2324,6 @@ match x {
23292324
}
23302325
~~~~
23312326

2332-
Records and structures can also be pattern-matched and their fields bound to variables.
2333-
When matching fields of a record,
2334-
the fields being matched are specified first,
2335-
then a placeholder (`_`) represents the remaining fields.
2336-
2337-
~~~~
2338-
# type options = {choose: bool, size: ~str};
2339-
# type player = {player: ~str, stats: (), options: options};
2340-
# fn load_stats() { }
2341-
# fn choose_player(r: &player) { }
2342-
# fn next_player() { }
2343-
2344-
fn main() {
2345-
let r = {
2346-
player: ~"ralph",
2347-
stats: load_stats(),
2348-
options: {
2349-
choose: true,
2350-
size: ~"small"
2351-
}
2352-
};
2353-
2354-
match r {
2355-
{options: {choose: true, _}, _} => {
2356-
choose_player(&r)
2357-
}
2358-
{player: ref p, options: {size: ~"small", _}, _} => {
2359-
log(info, (copy *p) + ~" is small");
2360-
}
2361-
_ => {
2362-
next_player();
2363-
}
2364-
}
2365-
}
2366-
~~~~
2367-
23682327
Patterns that bind variables default to binding to a copy of the matched value. This can be made
23692328
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
23702329
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
@@ -2598,8 +2557,8 @@ order specified by the tuple type.
25982557
An example of a tuple type and its use:
25992558

26002559
~~~~
2601-
type Pair = (int,&str);
2602-
let p: Pair = (10,"hello");
2560+
type Pair<'self> = (int,&'self str);
2561+
let p: Pair<'static> = (10,"hello");
26032562
let (a, b) = p;
26042563
assert b != "world";
26052564
~~~~
@@ -2644,7 +2603,10 @@ the resulting `struct` value will always be laid out in memory in the order spec
26442603
The fields of a `struct` may be qualified by [visibility modifiers](#visibility-modifiers),
26452604
to restrict access to implementation-private data in a structure.
26462605

2647-
A `tuple struct` type is just like a structure type, except that the fields are anonymous.
2606+
A _tuple struct_ type is just like a structure type, except that the fields are anonymous.
2607+
2608+
A _unit-like struct_ type is like a structure type, except that it has no fields.
2609+
The one value constructed by the associated [structure expression](#structure-expression) is the only value that inhabits such a type.
26482610

26492611
### Enumerated types
26502612

@@ -2693,25 +2655,6 @@ let a: List<int> = Cons(7, @Cons(13, @Nil));
26932655
~~~~
26942656

26952657

2696-
### Record types
2697-
2698-
> **Note:** Records are not nominal types, thus do not directly support recursion, visibility control,
2699-
> out-of-order field initialization, or coherent trait implementation.
2700-
> Records are therefore deprecated and will be removed in future versions of Rust.
2701-
> [Structure types](#structure-types) should be used instead.
2702-
2703-
The record type-constructor forms a new heterogeneous product of values.
2704-
Fields of a record type are accessed by name and are arranged in memory in the order specified by the record type.
2705-
2706-
An example of a record type and its use:
2707-
2708-
~~~~
2709-
type Point = {x: int, y: int};
2710-
let p: Point = {x: 10, y: 11};
2711-
let px: int = p.x;
2712-
~~~~
2713-
2714-
27152658
### Pointer types
27162659

27172660
All pointers in Rust are explicit first-class values.
@@ -2776,7 +2719,7 @@ fn add(x: int, y: int) -> int {
27762719
27772720
let mut x = add(5,7);
27782721
2779-
type Binop = fn(int,int) -> int;
2722+
type Binop<'self> = &'self fn(int,int) -> int;
27802723
let bo: Binop = add;
27812724
x = bo(5,7);
27822725
~~~~~~~~
@@ -3041,7 +2984,8 @@ Some operations (such as field selection) implicitly dereference boxes. An
30412984
example of an _implicit dereference_ operation performed on box values:
30422985

30432986
~~~~~~~~
3044-
let x = @{y: 10};
2987+
struct Foo { y: int }
2988+
let x = @Foo{y: 10};
30452989
assert x.y == 10;
30462990
~~~~~~~~
30472991

0 commit comments

Comments
 (0)