Skip to content

Commit 861052f

Browse files
committed
---
yaml --- r: 138643 b: refs/heads/try2 c: 95bc9ea h: refs/heads/master i: 138641: fe87f1e 138639: 3276834 v: v3
1 parent 8a2a91d commit 861052f

Some content is hidden

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

56 files changed

+239
-528
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: d3b94f6f341e935910aff59ea187af7b34055be8
8+
refs/heads/try2: 95bc9ea26df56b29f74583317ab080fdc7b99757
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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 accept pull-requests that try to "sneak" unrelated changes in.
14+
We will not look 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/try2/doc/rust.md

Lines changed: 18 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,6 @@ 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-
916911
Since a parameter type is opaque to the generic function, the set of
917912
operations that can be performed on it is limited. Values of parameter
918913
type can always be moved, but they can only be copied when the
@@ -1090,15 +1085,6 @@ let p = Point(10, 11);
10901085
let px: int = match p { Point(x, _) => x };
10911086
~~~~
10921087

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-
11021088
### Enumerations
11031089

11041090
An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -1299,19 +1285,22 @@ An _implementation_ is an item that implements a [trait](#traits) for a specific
12991285
Implementations are defined with the keyword `impl`.
13001286

13011287
~~~~
1302-
# type Point = {x: float, y: float};
1288+
# struct Point {x: float, y: float};
13031289
# type Surface = int;
1304-
# type BoundingBox = {x: float, y: float, width: float, height: float};
1290+
# struct BoundingBox {x: float, y: float, width: float, height: float};
13051291
# trait Shape { fn draw(Surface); fn bounding_box() -> BoundingBox; }
13061292
# fn do_draw_circle(s: Surface, c: Circle) { }
13071293
1308-
type Circle = {radius: float, center: Point};
1294+
struct Circle {
1295+
radius: float,
1296+
center: Point,
1297+
}
13091298
13101299
impl Shape for Circle {
13111300
fn draw(s: Surface) { do_draw_circle(s, self); }
13121301
fn bounding_box() -> BoundingBox {
13131302
let r = self.radius;
1314-
{x: self.center.x - r, y: self.center.y - r,
1303+
BoundingBox{x: self.center.x - r, y: self.center.y - r,
13151304
width: 2.0 * r, height: 2.0 * r}
13161305
}
13171306
}
@@ -1604,8 +1593,7 @@ struct_expr : expr_path '{' ident ':' expr
16041593
[ ',' ident ':' expr ] *
16051594
[ ".." expr ] '}' |
16061595
expr_path '(' expr
1607-
[ ',' expr ] * ')' |
1608-
expr_path
1596+
[ ',' expr ] * ')'
16091597
~~~~~~~~
16101598

16111599
There are several forms of structure expressions.
@@ -1615,28 +1603,23 @@ providing the field values of a new instance of the structure.
16151603
A field name can be any identifier, and is separated from its value expression by a colon.
16161604
To indicate that a field is mutable, the `mut` keyword is written before its name.
16171605

1618-
A _tuple structure expression_ consists of the [path](#paths) of a [structure item](#structures),
1606+
A _tuple structure expression_ constists of the [path](#paths) of a [structure item](#structures),
16191607
followed by a parenthesized list of one or more comma-separated expressions
16201608
(in other words, the path of a structured item followed by a tuple expression).
16211609
The structure item must be a tuple structure item.
16221610

1623-
A _unit-like structure expression_ consists only of the [path](#paths) of a [structure item](#structures).
1624-
16251611
The following are examples of structure expressions:
16261612

16271613
~~~~
16281614
# struct Point { x: float, y: float }
16291615
# struct TuplePoint(float, float);
16301616
# mod game { pub struct User { name: &str, age: uint, score: uint } }
1631-
# struct Cookie; fn some_fn<T>(t: T) {}
16321617
Point {x: 10f, y: 20f};
16331618
TuplePoint(10f, 20f);
16341619
let u = game::User {name: "Joe", age: 35u, score: 100_000};
1635-
some_fn::<Cookie>(Cookie);
16361620
~~~~
16371621

16381622
A structure expression forms a new value of the named structure type.
1639-
Note that for a given *unit-like* structure type, this will always be the same value.
16401623

16411624
A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
16421625
The expression following `..` (the base) must be of the same structure type as the new structure type being formed.
@@ -1657,38 +1640,6 @@ rec_expr : '{' ident ':' expr
16571640
[ ".." expr ] '}'
16581641
~~~~~~~~
16591642

1660-
> **Note:** In future versions of Rust, record expressions and [record types](#record-types) will be removed.
1661-
1662-
A [_record_](#record-types) _expression_ is one or more comma-separated
1663-
name-value pairs enclosed by braces. A fieldname can be any identifier,
1664-
and is separated from its value expression by a
1665-
colon. To indicate that a field is mutable, the `mut` keyword is
1666-
written before its name.
1667-
1668-
~~~~
1669-
{x: 10f, y: 20f};
1670-
{name: "Joe", age: 35u, score: 100_000};
1671-
{ident: "X", mut count: 0u};
1672-
~~~~
1673-
1674-
The order of the fields in a record expression is significant, and
1675-
determines the type of the resulting value. `{a: u8, b: u8}` and `{b:
1676-
u8, a: u8}` are two different fields.
1677-
1678-
A record expression can terminate with the syntax `..` followed by an
1679-
expression to denote a functional update. The expression following
1680-
`..` (the base) must be of a record type that includes at least all the
1681-
fields mentioned in the record expression. A new record will be
1682-
created, of the same type as the base expression, with the given
1683-
values for the fields that were explicitly specified, and the values
1684-
in the base record for all other fields. The ordering of the fields in
1685-
such a record expression is not significant.
1686-
1687-
~~~~
1688-
let base = {x: 1, y: 2, z: 3};
1689-
{y: 0, z: 10, .. base};
1690-
~~~~
1691-
16921643
### Method-call expressions
16931644

16941645
~~~~~~~~{.ebnf .gram}
@@ -1709,7 +1660,7 @@ field_expr : expr '.' ident
17091660

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

17141665
~~~~~~~~ {.field}
17151666
myrecord.myfield;
@@ -1925,8 +1876,10 @@ An example of three different swap expressions:
19251876
# let mut x = &mut [0];
19261877
# let mut a = &mut [0];
19271878
# let i = 0;
1928-
# let y = {mut z: 0};
1929-
# let b = {mut c: 0};
1879+
# struct S1 { z: int };
1880+
# struct S2 { c: int };
1881+
# let mut y = S1{z: 0};
1882+
# let mut b = S2{c: 0};
19301883
19311884
x <-> a;
19321885
x[i] <-> a[i];
@@ -2060,14 +2013,12 @@ an optional reference slot to serve as the function's output, bound to the
20602013
`lval` on the right hand side of the call. If the function eventually returns,
20612014
then the expression completes.
20622015

2063-
Some examples of call expressions:
2016+
An example of a call expression:
20642017

20652018
~~~~
20662019
# fn add(x: int, y: int) -> int { 0 }
2067-
# use core::from_str::FromStr::from_str;
20682020
20692021
let x: int = add(1, 2);
2070-
let pi = from_str::<f32>("3.14");
20712022
~~~~
20722023

20732024
### Lambda expressions
@@ -2350,42 +2301,6 @@ match x {
23502301
}
23512302
~~~~
23522303

2353-
Records and structures can also be pattern-matched and their fields bound to variables.
2354-
When matching fields of a record,
2355-
the fields being matched are specified first,
2356-
then a placeholder (`_`) represents the remaining fields.
2357-
2358-
~~~~
2359-
# type options = {choose: bool, size: ~str};
2360-
# type player = {player: ~str, stats: (), options: options};
2361-
# fn load_stats() { }
2362-
# fn choose_player(r: &player) { }
2363-
# fn next_player() { }
2364-
2365-
fn main() {
2366-
let r = {
2367-
player: ~"ralph",
2368-
stats: load_stats(),
2369-
options: {
2370-
choose: true,
2371-
size: ~"small"
2372-
}
2373-
};
2374-
2375-
match r {
2376-
{options: {choose: true, _}, _} => {
2377-
choose_player(&r)
2378-
}
2379-
{player: ref p, options: {size: ~"small", _}, _} => {
2380-
log(info, (copy *p) + ~" is small");
2381-
}
2382-
_ => {
2383-
next_player();
2384-
}
2385-
}
2386-
}
2387-
~~~~
2388-
23892304
Patterns that bind variables default to binding to a copy of the matched value. This can be made
23902305
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
23912306
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
@@ -2665,10 +2580,7 @@ the resulting `struct` value will always be laid out in memory in the order spec
26652580
The fields of a `struct` may be qualified by [visibility modifiers](#visibility-modifiers),
26662581
to restrict access to implementation-private data in a structure.
26672582

2668-
A _tuple struct_ type is just like a structure type, except that the fields are anonymous.
2669-
2670-
A _unit-like struct_ type is like a structure type, except that it has no fields.
2671-
The one value constructed by the associated [structure expression](#structure-expression) is the only value that inhabits such a type.
2583+
A `tuple struct` type is just like a structure type, except that the fields are anonymous.
26722584

26732585
### Enumerated types
26742586

@@ -2717,25 +2629,6 @@ let a: List<int> = Cons(7, @Cons(13, @Nil));
27172629
~~~~
27182630

27192631

2720-
### Record types
2721-
2722-
> **Note:** Records are not nominal types, thus do not directly support recursion, visibility control,
2723-
> out-of-order field initialization, or coherent trait implementation.
2724-
> Records are therefore deprecated and will be removed in future versions of Rust.
2725-
> [Structure types](#structure-types) should be used instead.
2726-
2727-
The record type-constructor forms a new heterogeneous product of values.
2728-
Fields of a record type are accessed by name and are arranged in memory in the order specified by the record type.
2729-
2730-
An example of a record type and its use:
2731-
2732-
~~~~
2733-
type Point = {x: int, y: int};
2734-
let p: Point = {x: 10, y: 11};
2735-
let px: int = p.x;
2736-
~~~~
2737-
2738-
27392632
### Pointer types
27402633

27412634
All pointers in Rust are explicit first-class values.
@@ -3065,7 +2958,8 @@ Some operations (such as field selection) implicitly dereference boxes. An
30652958
example of an _implicit dereference_ operation performed on box values:
30662959

30672960
~~~~~~~~
3068-
let x = @{y: 10};
2961+
struct Foo { y: int }
2962+
let x = @Foo{y: 10};
30692963
assert x.y == 10;
30702964
~~~~~~~~
30712965

branches/try2/doc/tutorial-borrowed-ptr.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ operator. For example, I could write:
166166
# struct Point {x: float, y: float} // as before
167167
# struct Size {w: float, h: float} // as before
168168
# struct Rectangle {origin: Point, size: Size}
169-
# let rect_stack = &{origin: Point {x: 1f, y: 2f}, size: Size {w: 3f, h: 4f}};
170-
# let rect_managed = @{origin: Point {x: 3f, y: 4f}, size: Size {w: 3f, h: 4f}};
171-
# let rect_unique = ~{origin: Point {x: 5f, y: 6f}, size: Size {w: 3f, h: 4f}};
169+
# let rect_stack = &Rectangle {origin: Point {x: 1f, y: 2f}, size: Size {w: 3f, h: 4f}};
170+
# let rect_managed = @Rectangle {origin: Point {x: 3f, y: 4f}, size: Size {w: 3f, h: 4f}};
171+
# let rect_unique = ~Rectangle {origin: Point {x: 5f, y: 6f}, size: Size {w: 3f, h: 4f}};
172172
# fn compute_distance(p1: &Point, p2: &Point) -> float { 0f }
173173
compute_distance(&rect_stack.origin, &rect_managed.origin);
174174
~~~
@@ -274,13 +274,14 @@ the following function is legal:
274274

275275
~~~
276276
# fn some_condition() -> bool { true }
277+
# struct Foo { f: int }
277278
fn example3() -> int {
278-
let mut x = ~{f: 3};
279+
let mut x = ~Foo {f: 3};
279280
if some_condition() {
280281
let y = &x.f; // -+ L
281282
return *y; // |
282283
} // -+
283-
x = ~{f: 4};
284+
x = ~Foo {f: 4};
284285
...
285286
# return 0;
286287
}

branches/try2/src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub mod raw {
183183
use at_vec::{capacity, rustrt};
184184
use cast::transmute;
185185
use libc;
186-
use unstable::intrinsics::{move_val_init};
186+
use private::intrinsics::{move_val_init};
187187
use ptr::addr_of;
188188
use ptr;
189189
use sys;

branches/try2/src/libcore/cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn debug_mem() -> bool {
154154
#[cfg(notest)]
155155
#[lang="annihilate"]
156156
pub unsafe fn annihilate() {
157-
use unstable::lang::local_free;
157+
use rt::local_free;
158158
use io::WriterUtil;
159159
use io;
160160
use libc;

branches/try2/src/libcore/comm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use either::{Either, Left, Right};
1212
use kinds::Owned;
1313
use option;
1414
use option::{Option, Some, None, unwrap};
15-
use unstable;
15+
use private;
1616
use vec;
1717

1818
use pipes::{recv, try_recv, wait_many, peek, PacketHeader};
@@ -242,7 +242,7 @@ impl<T: Owned> Peekable<T> for PortSet<T> {
242242
}
243243
244244
/// A channel that can be shared between many senders.
245-
pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
245+
pub type SharedChan<T> = private::Exclusive<Chan<T>>;
246246
247247
impl<T: Owned> GenericChan<T> for SharedChan<T> {
248248
fn send(x: T) {
@@ -268,7 +268,7 @@ impl<T: Owned> GenericSmartChan<T> for SharedChan<T> {
268268
269269
/// Converts a `chan` into a `shared_chan`.
270270
pub fn SharedChan<T:Owned>(c: Chan<T>) -> SharedChan<T> {
271-
unstable::exclusive(c)
271+
private::exclusive(c)
272272
}
273273
274274
/// Receive a message from one of two endpoints.

branches/try2/src/libcore/core.rc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,11 @@ pub const debug : u32 = 4_u32;
225225

226226
/* Unsupported interfaces */
227227

228+
// The runtime interface used by the compiler
229+
#[cfg(notest)] pub mod rt;
228230
// Private APIs
229-
pub mod unstable;
230-
// NOTE: Remove after snapshot
231-
#[cfg(stage0)]
232-
pub mod private {
233-
pub use super::unstable::extfmt;
234-
}
231+
pub mod private;
232+
235233

236234
/* For internal use, not exported */
237235

0 commit comments

Comments
 (0)