Skip to content

Commit 493672b

Browse files
committed
---
yaml --- r: 139001 b: refs/heads/try2 c: 2293b07 h: refs/heads/master i: 138999: 8fbe7a9 v: v3
1 parent cccdc63 commit 493672b

File tree

723 files changed

+9328
-5335
lines changed

Some content is hidden

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

723 files changed

+9328
-5335
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: d8094f8602247927a39d33cbad13bdff3b2d467f
8+
refs/heads/try2: 2293b075b83d78b8139c0767c8034582112737bc
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: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,90 @@
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, replaced with `Clone`?
14+
* `std::map` removed, replaced with `core::hashmap`
15+
16+
* Syntax changes
17+
* The self type parameter in traits is now spelled `Self`
18+
* Replaced the `Durable` trait with the `'static` lifetime
19+
* The old closure type syntax with the trailing sigil has been
20+
removed in favor of the more consistent leading sigil
21+
* `super` is a keyword, and may be prefixed to paths
22+
* Trait bounds are separated with `+` instead of whitespace
23+
* Traits are implemented with `impl Trait for Type`
24+
instead of `impl Type: Trait`
25+
* The `export` keyword has finally been removed
26+
* The `move` keyword has been removed (linear types move by default)
27+
* The interior mutability qualifier on vectors, `[mut T]`, has been
28+
removed. Use `&mut [T]`, etc.
29+
* `mut` is no longer valid in `~mut T`. Use inherited mutability
30+
* `fail` is no longer a keyword. Use `fail!()`
31+
* `assert` is no longer a keyword. Use `assert!()`
32+
* `log` is no longer a keyword. use `debug!`, etc.
33+
* 1-tuples may be represented as `(T,)`
34+
* Struct fields may no longer be `mut`. Use inherited mutability,
35+
`@mut T`, `core::mut` or `core::cell`
36+
* `extern mod { ... }` is no longer valid syntax for foreign
37+
function modules. Use extern blocks: `extern { ... }`
38+
* Newtype enums removed. Used tuple-structs.
39+
* Trait implementations no longer support visibility modifiers
40+
41+
* Semantic changes
42+
* Types with owned pointers or custom destructors move by default,
43+
eliminating the `move` keyword
44+
* All foreign functions are considered unsafe
45+
* &mut is now unaliasable
46+
* Writes to borrowed @mut pointers are prevented dynamically
47+
* () has size 0
48+
* The name of the main function can be customized using #[main]
49+
* The default type of an inferred closure is &fn instead of @fn
50+
* Name resolution continues to be tweaked
51+
* Method visibility is inherited from the implementation declaration
52+
53+
* Other language changes
54+
* Structural records have been removed
55+
* Many more types can be used in constants, including enums
56+
`static lifetime pointers and vectors
57+
* Pattern matching over vectors improved and expanded
58+
* Typechecking of closure types has been overhauled to
59+
improve inference and eliminate unsoundness
60+
461
* Libraries
5-
* `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+
* Numeric traits have been reorganized under `core::num`
66+
* `vec::slice` finally returns a slice
67+
* `debug!` and friends don't require a format string, e.g. `debug!(Foo)`
68+
* Containers reorganized around traits in `core::container`
69+
* `core::dvec` removed, `~[T]` is a drop-in replacement
70+
* `core::send_map` renamed to `core::hashmap`
71+
* `std::treemap` reimplemented as an owned balanced tree
72+
* `std::deque` and `std::smallintmap` reimplemented as owned containers
73+
* `core::trie` added as a fast ordered map for integer keys
74+
* Set types added to `core::hashmap`, `core::trie` and `std::treemap`
75+
76+
* Tools
77+
* Replaced the 'cargo' package manager with 'rustpkg'
78+
* Added all-purpose 'rust' tool
79+
* `rustc --test` now supports a benchmarks with the `#[bench]` attribute
80+
* rustc now attempts to offer spelling suggestions
81+
82+
* Misc
83+
* Improved support for ARM and Android
84+
* Preliminary MIPS backend
85+
* Improved foreign function ABI implementation for x86, x86_64
86+
* Various and memory usage improvements
87+
* Rust code may be embedded in foreign code under limited circumstances
688

789
Version 0.5 (December 2012)
890
---------------------------

branches/try2/doc/rust.md

Lines changed: 35 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ do drop
212212
else enum extern
213213
false fn for
214214
if impl
215-
let log loop
215+
let loop
216216
match mod mut
217217
priv pub pure
218218
ref return
@@ -805,21 +805,20 @@ Use declarations support a number of "convenience" notations:
805805
An example of `use` declarations:
806806

807807
~~~~
808-
use foo = core::info;
809808
use core::float::sin;
810809
use core::str::{slice, to_upper};
811810
use core::option::Some;
812811
813812
fn main() {
814-
// Equivalent to 'log(core::info, core::float::sin(1.0));'
815-
log(foo, sin(1.0));
813+
// Equivalent to 'info!(core::float::sin(1.0));'
814+
info!(sin(1.0));
816815
817-
// Equivalent to 'log(core::info, core::option::Some(1.0));'
818-
log(info, Some(1.0));
816+
// Equivalent to 'info!(core::option::Some(1.0));'
817+
info!(Some(1.0));
819818
820-
// Equivalent to 'log(core::info,
821-
// core::str::to_upper(core::str::slice("foo", 0, 1)));'
822-
log(info, to_upper(slice("foo", 0, 1)));
819+
// Equivalent to
820+
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
821+
info!(to_upper(slice("foo", 0, 1)));
823822
}
824823
~~~~
825824

@@ -889,10 +888,10 @@ declared, in an angle-bracket-enclosed, comma-separated list following
889888
the function name.
890889

891890
~~~~ {.xfail-test}
892-
fn iter<T>(seq: &[T], f: fn(T)) {
891+
fn iter<T>(seq: &[T], f: &fn(T)) {
893892
for seq.each |elt| { f(elt); }
894893
}
895-
fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
894+
fn map<T, U>(seq: &[T], f: &fn(T) -> U) -> ~[U] {
896895
let mut acc = ~[];
897896
for seq.each |elt| { acc.push(f(elt)); }
898897
acc
@@ -990,7 +989,7 @@ output slot type would normally be. For example:
990989

991990
~~~~
992991
fn my_err(s: &str) -> ! {
993-
log(info, s);
992+
info!(s);
994993
fail!();
995994
}
996995
~~~~
@@ -1182,8 +1181,8 @@ Traits are implemented for specific types through separate [implementations](#im
11821181
# type BoundingBox = int;
11831182
11841183
trait Shape {
1185-
fn draw(Surface);
1186-
fn bounding_box() -> BoundingBox;
1184+
fn draw(&self, Surface);
1185+
fn bounding_box(&self) -> BoundingBox;
11871186
}
11881187
~~~~
11891188

@@ -1196,9 +1195,9 @@ These appear after the trait name, using the same syntax used in [generic functi
11961195

11971196
~~~~
11981197
trait Seq<T> {
1199-
fn len() -> uint;
1200-
fn elt_at(n: uint) -> T;
1201-
fn iter(fn(T));
1198+
fn len(&self) -> uint;
1199+
fn elt_at(&self, n: uint) -> T;
1200+
fn iter(&self, &fn(T));
12021201
}
12031202
~~~~
12041203

@@ -1210,7 +1209,7 @@ For example:
12101209

12111210
~~~~
12121211
# type Surface = int;
1213-
# trait Shape { fn draw(Surface); }
1212+
# trait Shape { fn draw(&self, Surface); }
12141213
12151214
fn draw_twice<T: Shape>(surface: Surface, sh: T) {
12161215
sh.draw(surface);
@@ -1228,7 +1227,7 @@ to pointers to the trait name, used as a type.
12281227
# impl Shape for int { }
12291228
# let mycircle = 0;
12301229
1231-
let myshape: Shape = @mycircle as @Shape;
1230+
let myshape: @Shape = @mycircle as @Shape;
12321231
~~~~
12331232

12341233
The resulting value is a managed box containing the value that was cast,
@@ -1272,8 +1271,8 @@ methods of the supertrait may be called on values of subtrait-bound type paramet
12721271
Refering to the previous example of `trait Circle : Shape`:
12731272

12741273
~~~
1275-
# trait Shape { fn area() -> float; }
1276-
# trait Circle : Shape { fn radius() -> float; }
1274+
# trait Shape { fn area(&self) -> float; }
1275+
# trait Circle : Shape { fn radius(&self) -> float; }
12771276
fn radius_times_area<T: Circle>(c: T) -> float {
12781277
// `c` is both a Circle and a Shape
12791278
c.radius() * c.area()
@@ -1283,10 +1282,10 @@ fn radius_times_area<T: Circle>(c: T) -> float {
12831282
Likewise, supertrait methods may also be called on trait objects.
12841283

12851284
~~~ {.xfail-test}
1286-
# trait Shape { fn area() -> float; }
1287-
# trait Circle : Shape { fn radius() -> float; }
1288-
# impl Shape for int { fn area() -> float { 0.0 } }
1289-
# impl Circle for int { fn radius() -> float { 0.0 } }
1285+
# trait Shape { fn area(&self) -> float; }
1286+
# trait Circle : Shape { fn radius(&self) -> float; }
1287+
# impl Shape for int { fn area(&self) -> float { 0.0 } }
1288+
# impl Circle for int { fn radius(&self) -> float { 0.0 } }
12901289
# let mycircle = 0;
12911290
12921291
let mycircle: Circle = @mycircle as @Circle;
@@ -1303,7 +1302,7 @@ Implementations are defined with the keyword `impl`.
13031302
# struct Point {x: float, y: float};
13041303
# type Surface = int;
13051304
# struct BoundingBox {x: float, y: float, width: float, height: float};
1306-
# trait Shape { fn draw(Surface); fn bounding_box() -> BoundingBox; }
1305+
# trait Shape { fn draw(&self, Surface); fn bounding_box(&self) -> BoundingBox; }
13071306
# fn do_draw_circle(s: Surface, c: Circle) { }
13081307
13091308
struct Circle {
@@ -1312,8 +1311,8 @@ struct Circle {
13121311
}
13131312
13141313
impl Shape for Circle {
1315-
fn draw(s: Surface) { do_draw_circle(s, self); }
1316-
fn bounding_box() -> BoundingBox {
1314+
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
1315+
fn bounding_box(&self) -> BoundingBox {
13171316
let r = self.radius;
13181317
BoundingBox{x: self.center.x - r, y: self.center.y - r,
13191318
width: 2.0 * r, height: 2.0 * r}
@@ -2074,7 +2073,7 @@ and moving values from the environment into the lambda expression's captured env
20742073
An example of a lambda expression:
20752074

20762075
~~~~
2077-
fn ten_times(f: fn(int)) {
2076+
fn ten_times(f: &fn(int)) {
20782077
let mut i = 0;
20792078
while i < 10 {
20802079
f(i);
@@ -2177,7 +2176,7 @@ If the `expr` is a [field expression](#field-expressions), it is parsed as thoug
21772176
In this example, both calls to `f` are equivalent:
21782177

21792178
~~~~
2180-
# fn f(f: fn(int)) { }
2179+
# fn f(f: &fn(int)) { }
21812180
# fn g(i: int) { }
21822181
21832182
f(|j| g(j));
@@ -2397,58 +2396,6 @@ fn max(a: int, b: int) -> int {
23972396
}
23982397
~~~~
23992398

2400-
### Log expressions
2401-
2402-
~~~~~~~~{.ebnf .gram}
2403-
log_expr : "log" '(' level ',' expr ')' ;
2404-
~~~~~~~~
2405-
2406-
Evaluating a `log` expression may, depending on runtime configuration, cause a
2407-
value to be appended to an internal diagnostic logging buffer provided by the
2408-
runtime or emitted to a system console. Log expressions are enabled or
2409-
disabled dynamically at run-time on a per-task and per-item basis. See
2410-
[logging system](#logging-system).
2411-
2412-
Each `log` expression must be provided with a *level* argument in
2413-
addition to the value to log. The logging level is a `u32` value, where
2414-
lower levels indicate more-urgent levels of logging. By default, the lowest
2415-
four logging levels (`1_u32 ... 4_u32`) are predefined as the constants
2416-
`error`, `warn`, `info` and `debug` in the `core` library.
2417-
2418-
Additionally, the macros `error!`, `warn!`, `info!` and `debug!` are defined
2419-
in the default syntax-extension namespace. These expand into calls to the
2420-
logging facility composed with calls to the `fmt!` string formatting
2421-
syntax-extension.
2422-
2423-
The following examples all produce the same output, logged at the `error`
2424-
logging level:
2425-
2426-
~~~~
2427-
# let filename = "bulbasaur";
2428-
2429-
// Full version, logging a value.
2430-
log(core::error, ~"file not found: " + filename);
2431-
2432-
// Log-level abbreviated, since core::* is used by default.
2433-
log(error, ~"file not found: " + filename);
2434-
2435-
// Formatting the message using a format-string and fmt!
2436-
log(error, fmt!("file not found: %s", filename));
2437-
2438-
// Using the error! macro, that expands to the previous call.
2439-
error!("file not found: %s", filename);
2440-
~~~~
2441-
2442-
A `log` expression is *not evaluated* when logging at the specified logging-level, module or task is disabled at runtime.
2443-
This makes inactive `log` expressions very cheap;
2444-
they should be used extensively in Rust code, as diagnostic aids,
2445-
as they add little overhead beyond a single integer-compare and branch at runtime.
2446-
2447-
Logging is presently implemented as a language built-in feature,
2448-
as it makes use of compiler-provided, per-module data tables and flags.
2449-
In the future, logging will move into a library, and will no longer be a core expression type.
2450-
It is therefore recommended to use the macro forms of logging (`error!`, `debug!`, etc.) to minimize disruption in code that uses logging.
2451-
24522399

24532400
# Type system
24542401

@@ -2731,11 +2678,11 @@ An example of an object type:
27312678

27322679
~~~~~~~~
27332680
trait Printable {
2734-
fn to_str() -> ~str;
2681+
fn to_str(&self) -> ~str;
27352682
}
27362683
27372684
impl Printable for int {
2738-
fn to_str() -> ~str { int::to_str(self) }
2685+
fn to_str(&self) -> ~str { int::to_str(*self) }
27392686
}
27402687
27412688
fn print(a: @Printable) {
@@ -2755,7 +2702,7 @@ and the cast expression in `main`.
27552702
Within the body of an item that has type parameter declarations, the names of its type parameters are types:
27562703

27572704
~~~~~~~
2758-
fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: &[A]) -> ~[B] {
2705+
fn map<A: Copy, B: Copy>(f: &fn(A) -> B, xs: &[A]) -> ~[B] {
27592706
if xs.len() == 0 { return ~[]; }
27602707
let first: B = f(xs[0]);
27612708
let rest: ~[B] = map(f, xs.slice(1, xs.len()));
@@ -2774,11 +2721,11 @@ example, in:
27742721

27752722
~~~~~~~~
27762723
trait Printable {
2777-
fn make_string() -> ~str;
2724+
fn make_string(&self) -> ~str;
27782725
}
27792726
27802727
impl Printable for ~str {
2781-
fn make_string() -> ~str { copy self }
2728+
fn make_string(&self) -> ~str { copy *self }
27822729
}
27832730
~~~~~~~~
27842731

@@ -3149,7 +3096,7 @@ communication facilities.
31493096

31503097
The runtime contains a system for directing [logging
31513098
expressions](#log-expressions) to a logging console and/or internal logging
3152-
buffers. Logging expressions can be enabled per module.
3099+
buffers. Logging can be enabled per module.
31533100

31543101
Logging output is enabled by setting the `RUST_LOG` environment
31553102
variable. `RUST_LOG` accepts a logging specification made up of a

0 commit comments

Comments
 (0)