Skip to content

Commit cde0dc1

Browse files
committed
---
yaml --- r: 138941 b: refs/heads/try2 c: 014620a h: refs/heads/master i: 138939: bfc1fd7 v: v3
1 parent e33994c commit cde0dc1

File tree

304 files changed

+5032
-1939
lines changed

Some content is hidden

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

304 files changed

+5032
-1939
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: 1d315aac4403f22274fceab3e22ec1cdb95bad78
8+
refs/heads/try2: 014620af902c4798ede78462b2d0e3b749fb2fff
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,85 @@
1-
Version 0.6 (?)
1+
Version 0.6 (March 2013)
22
---------------------------
33

4+
* ~??? changes, numerous bugfixes
5+
6+
* TODO:
7+
* Ord/Cmp
8+
* Lifetime changes
9+
* Implicit self
10+
* Remove `static` keyword
11+
* Static method syntax
12+
* `as Trait`
13+
* `copy` removed?
14+
15+
* Syntax changes
16+
* The self type parameter in traits is now spelled `Self`
17+
* Replaced the `Durable` trait with the `'static` lifetime
18+
* The old closure type syntax with the trailing sigil has been
19+
removed in favor of the more consistent leading sigil
20+
* `super` is a keyword, and may be prefixed to paths
21+
* Trait bounds are separated with `+` instead of whitespace
22+
* Traits are implemented with `impl Trait for Type`
23+
instead of `impl Type: Trait`
24+
* The `export` keyword has finally been removed
25+
* The `move` keyword has been removed (linear types move by default)
26+
* The interior mutability qualifier on vectors, `[mut T]`, has been
27+
removed. Use `&mut [T]`, etc.
28+
* `mut` is no longer valid in `~mut T`. Use inherited mutability
29+
* `fail` is no longer a keyword. Use `fail!()`
30+
* `assert` is no longer a keyword. Use `assert!()`
31+
* `log` is no longer a keyword. use `debug!`, etc.
32+
* 1-tuples may be represented as `(T,)`
33+
* Struct fields may no longer be `mut`. Use inherited mutability,
34+
`@mut T`, `core::mut` or `core::cell`
35+
* `extern mod { ... }` is no longer valid syntax for foreign
36+
function modules. Use extern blocks: `extern { ... }`
37+
* Newtype enums removed. Used tuple-structs.
38+
* Trait implementations no longer support visibility modifiers
39+
40+
* Semantic changes
41+
* Linear types move by default, eliminating the `move` keyword
42+
* All foreign functions are considered unsafe
43+
* &mut is now unaliasable
44+
* Writes to borrowed @mut pointers are prevented dynamically
45+
* () has size 0
46+
* The name of the main function can be customized using #[main]
47+
* The default type of an inferred closure is &fn instead of @fn
48+
* Name resolution continues to be tweaked
49+
* Method visibility is inherited from the implementation declaration
50+
51+
* Other language changes
52+
* Structural records have been removed
53+
* Many more types can be used in constants, including enums
54+
`static lifetime pointers and vectors
55+
* Pattern matching over vectors improved and expanded
56+
* Typechecking of closure types has been overhauled to
57+
improve inference and eliminate unsoundness
58+
459
* Libraries
5-
* `core::send_map` renamed to `core::hashmap`
60+
* Lots of effort to organize the container API's around `core::container`
61+
* `core::send_map` renamed to `core::hashmap`
62+
* Added big integers to `std::bigint`
63+
* Removed `core::oldcomm` module
64+
* Added pipe-based `core::comm` module
65+
* Reimplemented `std::treemap`
66+
* Numeric traits have been reorganized under `core::num`
67+
* `core::dvec` removed. Use `@mut ~[T]` or other language types
68+
* `vec::slice` finally returns a slice
69+
* `debug!` and friends don't require a format string, e.g. `debug!(Foo)`
70+
71+
* Tools
72+
* Replaced the 'cargo' package manager with 'rustpkg'
73+
* Added all-purpose 'rust' tool
74+
* `rustc --test` now supports a benchmarks with the `#[bench]` attribute
75+
* rustc now attempts to offer spelling suggestions
76+
77+
* Misc
78+
* Improved support for ARM and Android
79+
* Preliminary MIPS backend
80+
* Improved foreign function ABI implementation for x86, x86_64
81+
* Various and memory usage improvements
82+
* Rust code may be embedded in foreign code under limited circumstances
683

784
Version 0.5 (December 2012)
885
---------------------------

branches/try2/doc/rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,10 +889,10 @@ declared, in an angle-bracket-enclosed, comma-separated list following
889889
the function name.
890890

891891
~~~~ {.xfail-test}
892-
fn iter<T>(seq: &[T], f: fn(T)) {
892+
fn iter<T>(seq: &[T], f: &fn(T)) {
893893
for seq.each |elt| { f(elt); }
894894
}
895-
fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
895+
fn map<T, U>(seq: &[T], f: &fn(T) -> U) -> ~[U] {
896896
let mut acc = ~[];
897897
for seq.each |elt| { acc.push(f(elt)); }
898898
acc
@@ -1198,7 +1198,7 @@ These appear after the trait name, using the same syntax used in [generic functi
11981198
trait Seq<T> {
11991199
fn len() -> uint;
12001200
fn elt_at(n: uint) -> T;
1201-
fn iter(fn(T));
1201+
fn iter(&fn(T));
12021202
}
12031203
~~~~
12041204

@@ -2074,7 +2074,7 @@ and moving values from the environment into the lambda expression's captured env
20742074
An example of a lambda expression:
20752075

20762076
~~~~
2077-
fn ten_times(f: fn(int)) {
2077+
fn ten_times(f: &fn(int)) {
20782078
let mut i = 0;
20792079
while i < 10 {
20802080
f(i);
@@ -2177,7 +2177,7 @@ If the `expr` is a [field expression](#field-expressions), it is parsed as thoug
21772177
In this example, both calls to `f` are equivalent:
21782178

21792179
~~~~
2180-
# fn f(f: fn(int)) { }
2180+
# fn f(f: &fn(int)) { }
21812181
# fn g(i: int) { }
21822182
21832183
f(|j| g(j));
@@ -2755,7 +2755,7 @@ and the cast expression in `main`.
27552755
Within the body of an item that has type parameter declarations, the names of its type parameters are types:
27562756

27572757
~~~~~~~
2758-
fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: &[A]) -> ~[B] {
2758+
fn map<A: Copy, B: Copy>(f: &fn(A) -> B, xs: &[A]) -> ~[B] {
27592759
if xs.len() == 0 { return ~[]; }
27602760
let first: B = f(xs[0]);
27612761
let rest: ~[B] = map(f, xs.slice(1, xs.len()));

branches/try2/doc/tutorial.md

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -681,45 +681,6 @@ the value of `North` is 0, `East` is 1, `South` is 2, and `West` is 3.
681681
When an enum is C-like, you can apply the `as` cast operator to
682682
convert it to its discriminator value as an `int`.
683683

684-
<a name="single_variant_enum"></a>
685-
686-
There is a special case for enums with a single variant, which are
687-
sometimes called "newtype-style enums" (after Haskell's "newtype"
688-
feature). These are used to define new types in such a way that the
689-
new name is not just a synonym for an existing type, but its own
690-
distinct type: `type` creates a structural synonym, while this form of
691-
`enum` creates a nominal synonym. If you say:
692-
693-
~~~~
694-
enum GizmoId = int;
695-
~~~~
696-
697-
That is a shorthand for this:
698-
699-
~~~~
700-
enum GizmoId { GizmoId(int) }
701-
~~~~
702-
703-
You can extract the contents of such an enum type with the
704-
dereference (`*`) unary operator:
705-
706-
~~~~
707-
# enum GizmoId = int;
708-
let my_gizmo_id: GizmoId = GizmoId(10);
709-
let id_int: int = *my_gizmo_id;
710-
~~~~
711-
712-
Types like this can be useful to differentiate between data that have
713-
the same type but must be used in different ways.
714-
715-
~~~~
716-
enum Inches = int;
717-
enum Centimeters = int;
718-
~~~~
719-
720-
The above definitions allow for a simple way for programs to avoid
721-
confusing numbers that correspond to different units.
722-
723684
For enum types with multiple variants, destructuring is the only way to
724685
get at their contents. All variant constructors can be used as
725686
patterns, as in this definition of `area`:
@@ -789,10 +750,10 @@ match mytup {
789750

790751
## Tuple structs
791752

792-
Rust also has _nominal tuples_, which behave like both structs and tuples,
793-
except that nominal tuple types have names
794-
(so `Foo(1, 2)` has a different type from `Bar(1, 2)`),
795-
and nominal tuple types' _fields_ do not have names.
753+
Rust also has _tuple structs_, which behave like both structs and tuples,
754+
except that, unlike tuples, tuple structs have names (so `Foo(1, 2)` has a
755+
different type from `Bar(1, 2)`), and tuple structs' _fields_ do not have
756+
names.
796757

797758
For example:
798759
~~~~
@@ -803,6 +764,37 @@ match mytup {
803764
}
804765
~~~~
805766

767+
<a name="newtype"></a>
768+
769+
There is a special case for tuple structs with a single field, which are
770+
sometimes called "newtypes" (after Haskell's "newtype" feature). These are
771+
used to define new types in such a way that the new name is not just a
772+
synonym for an existing type but is rather its own distinct type.
773+
774+
~~~~
775+
struct GizmoId(int);
776+
~~~~
777+
778+
For convenience, you can extract the contents of such a struct with the
779+
dereference (`*`) unary operator:
780+
781+
~~~~
782+
# struct GizmoId(int);
783+
let my_gizmo_id: GizmoId = GizmoId(10);
784+
let id_int: int = *my_gizmo_id;
785+
~~~~
786+
787+
Types like this can be useful to differentiate between data that have
788+
the same type but must be used in different ways.
789+
790+
~~~~
791+
struct Inches(int);
792+
struct Centimeters(int);
793+
~~~~
794+
795+
The above definitions allow for a simple way for programs to avoid
796+
confusing numbers that correspond to different units.
797+
806798
# Functions
807799

808800
We've already seen several function definitions. Like all other static
@@ -1369,7 +1361,7 @@ the enclosing scope.
13691361

13701362
~~~~
13711363
# use println = core::io::println;
1372-
fn call_closure_with_ten(b: fn(int)) { b(10); }
1364+
fn call_closure_with_ten(b: &fn(int)) { b(10); }
13731365
13741366
let captured_var = 20;
13751367
let closure = |arg| println(fmt!("captured_var=%d, arg=%d", captured_var, arg));
@@ -1455,7 +1447,7 @@ should almost always declare the type of that argument as `fn()`. That way,
14551447
callers may pass any kind of closure.
14561448

14571449
~~~~
1458-
fn call_twice(f: fn()) { f(); f(); }
1450+
fn call_twice(f: &fn()) { f(); f(); }
14591451
let closure = || { "I'm a closure, and it doesn't matter what type I am"; };
14601452
fn function() { "I'm a normal function"; }
14611453
call_twice(closure);
@@ -1475,7 +1467,7 @@ Consider this function that iterates over a vector of
14751467
integers, passing in a pointer to each integer in the vector:
14761468

14771469
~~~~
1478-
fn each(v: &[int], op: fn(v: &int)) {
1470+
fn each(v: &[int], op: &fn(v: &int)) {
14791471
let mut n = 0;
14801472
while n < v.len() {
14811473
op(&v[n]);
@@ -1496,7 +1488,7 @@ argument, we can write it in a way that has a pleasant, block-like
14961488
structure.
14971489

14981490
~~~~
1499-
# fn each(v: &[int], op: fn(v: &int)) { }
1491+
# fn each(v: &[int], op: &fn(v: &int)) { }
15001492
# fn do_some_work(i: &int) { }
15011493
each([1, 2, 3], |n| {
15021494
do_some_work(n);
@@ -1507,7 +1499,7 @@ This is such a useful pattern that Rust has a special form of function
15071499
call that can be written more like a built-in control structure:
15081500

15091501
~~~~
1510-
# fn each(v: &[int], op: fn(v: &int)) { }
1502+
# fn each(v: &[int], op: &fn(v: &int)) { }
15111503
# fn do_some_work(i: &int) { }
15121504
do each([1, 2, 3]) |n| {
15131505
do_some_work(n);
@@ -1554,7 +1546,7 @@ Consider again our `each` function, this time improved to
15541546
break early when the iteratee returns `false`:
15551547

15561548
~~~~
1557-
fn each(v: &[int], op: fn(v: &int) -> bool) {
1549+
fn each(v: &[int], op: &fn(v: &int) -> bool) {
15581550
let mut n = 0;
15591551
while n < v.len() {
15601552
if !op(&v[n]) {
@@ -1778,7 +1770,7 @@ vector consisting of the result of applying `function` to each element
17781770
of `vector`:
17791771

17801772
~~~~
1781-
fn map<T, U>(vector: &[T], function: fn(v: &T) -> U) -> ~[U] {
1773+
fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] {
17821774
let mut accumulator = ~[];
17831775
for vec::each(vector) |element| {
17841776
accumulator.push(function(element));
@@ -1977,12 +1969,12 @@ types might look like the following:
19771969
~~~~
19781970
trait Seq<T> {
19791971
fn len(&self) -> uint;
1980-
fn iter(&self, b: fn(v: &T));
1972+
fn iter(&self, b: &fn(v: &T));
19811973
}
19821974
19831975
impl<T> Seq<T> for ~[T] {
19841976
fn len(&self) -> uint { vec::len(*self) }
1985-
fn iter(&self, b: fn(v: &T)) {
1977+
fn iter(&self, b: &fn(v: &T)) {
19861978
for vec::each(*self) |elt| { b(elt); }
19871979
}
19881980
}
@@ -2294,7 +2286,7 @@ struct level. Note that fields and methods are _public_ by default.
22942286
pub mod farm {
22952287
# pub type Chicken = int;
22962288
# type Cow = int;
2297-
# enum Human = int;
2289+
# struct Human(int);
22982290
# impl Human { fn rest(&self) { } }
22992291
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
23002292
pub struct Farm {

branches/try2/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
103103
}
104104
}
105105
106-
fn iter_header(testfile: &Path, it: fn(~str) -> bool) -> bool {
106+
fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
107107
let rdr = io::file_reader(testfile).get();
108108
while !rdr.eof() {
109109
let ln = rdr.read_line();

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ fn compose_and_run(config: config, testfile: &Path,
530530
}
531531

532532
fn make_compile_args(config: config, props: TestProps, extras: ~[~str],
533-
xform: fn(config, (&Path)) -> Path,
533+
xform: &fn(config, (&Path)) -> Path,
534534
testfile: &Path) -> ProcArgs {
535535
let prog = config.rustc_path;
536536
let mut args = ~[testfile.to_str(),

branches/try2/src/libcore/at_vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub pure fn capacity<T>(v: @[const T]) -> uint {
6161
*/
6262
#[inline(always)]
6363
pub pure fn build_sized<A>(size: uint,
64-
builder: &fn(push: pure fn(v: A))) -> @[A] {
64+
builder: &fn(push: &pure fn(v: A))) -> @[A] {
6565
let mut vec: @[const A] = @[];
6666
unsafe { raw::reserve(&mut vec, size); }
6767
builder(|+x| unsafe { raw::push(&mut vec, x) });
@@ -79,7 +79,7 @@ pub pure fn build_sized<A>(size: uint,
7979
* onto the vector being constructed.
8080
*/
8181
#[inline(always)]
82-
pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
82+
pub pure fn build<A>(builder: &fn(push: &pure fn(v: A))) -> @[A] {
8383
build_sized(4, builder)
8484
}
8585

@@ -97,7 +97,7 @@ pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
9797
*/
9898
#[inline(always)]
9999
pub pure fn build_sized_opt<A>(size: Option<uint>,
100-
builder: &fn(push: pure fn(v: A))) -> @[A] {
100+
builder: &fn(push: &pure fn(v: A))) -> @[A] {
101101
build_sized(size.get_or_default(4), builder)
102102
}
103103

branches/try2/src/libcore/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub pure fn to_str(v: bool) -> ~str { if v { ~"true" } else { ~"false" } }
6767
* Iterates over all truth values by passing them to `blk` in an unspecified
6868
* order
6969
*/
70-
pub fn all_values(blk: fn(v: bool)) {
70+
pub fn all_values(blk: &fn(v: bool)) {
7171
blk(true);
7272
blk(false);
7373
}

0 commit comments

Comments
 (0)