Skip to content

Commit ff7fb8e

Browse files
bleibigbrson
authored andcommitted
---
yaml --- r: 138964 b: refs/heads/try2 c: c978025 h: refs/heads/master v: v3
1 parent 15d4ed4 commit ff7fb8e

File tree

538 files changed

+3871
-7063
lines changed

Some content is hidden

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

538 files changed

+3871
-7063
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: 695e9fd13cd71c87e9afc0903b3fb6856452d345
8+
refs/heads/try2: c978025d0dc416524313fd0c5f0797d9940574d9
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: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,8 @@
1-
Version 0.6 (March 2013)
1+
Version 0.6 (?)
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-
594
* Libraries
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
5+
* `core::send_map` renamed to `core::hashmap`
836

847
Version 0.5 (December 2012)
858
---------------------------

branches/try2/doc/rust.md

Lines changed: 69 additions & 16 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 loop
215+
let log loop
216216
match mod mut
217217
priv pub pure
218218
ref return
@@ -805,20 +805,21 @@ Use declarations support a number of "convenience" notations:
805805
An example of `use` declarations:
806806

807807
~~~~
808+
use foo = core::info;
808809
use core::float::sin;
809810
use core::str::{slice, to_upper};
810811
use core::option::Some;
811812
812813
fn main() {
813-
// Equivalent to 'info!(core::float::sin(1.0));'
814-
info!(sin(1.0));
814+
// Equivalent to 'log(core::info, core::float::sin(1.0));'
815+
log(foo, sin(1.0));
815816
816-
// Equivalent to 'info!(core::option::Some(1.0));'
817-
info!(Some(1.0));
817+
// Equivalent to 'log(core::info, core::option::Some(1.0));'
818+
log(info, Some(1.0));
818819
819-
// Equivalent to
820-
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
821-
info!(to_upper(slice("foo", 0, 1)));
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)));
822823
}
823824
~~~~
824825

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

890891
~~~~ {.xfail-test}
891-
fn iter<T>(seq: &[T], f: &fn(T)) {
892+
fn iter<T>(seq: &[T], f: fn(T)) {
892893
for seq.each |elt| { f(elt); }
893894
}
894-
fn map<T, U>(seq: &[T], f: &fn(T) -> U) -> ~[U] {
895+
fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
895896
let mut acc = ~[];
896897
for seq.each |elt| { acc.push(f(elt)); }
897898
acc
@@ -989,7 +990,7 @@ output slot type would normally be. For example:
989990

990991
~~~~
991992
fn my_err(s: &str) -> ! {
992-
info!(s);
993+
log(info, s);
993994
fail!();
994995
}
995996
~~~~
@@ -1197,7 +1198,7 @@ These appear after the trait name, using the same syntax used in [generic functi
11971198
trait Seq<T> {
11981199
fn len() -> uint;
11991200
fn elt_at(n: uint) -> T;
1200-
fn iter(&fn(T));
1201+
fn iter(fn(T));
12011202
}
12021203
~~~~
12031204

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

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

21782179
~~~~
2179-
# fn f(f: &fn(int)) { }
2180+
# fn f(f: fn(int)) { }
21802181
# fn g(i: int) { }
21812182
21822183
f(|j| g(j));
@@ -2396,6 +2397,58 @@ fn max(a: int, b: int) -> int {
23962397
}
23972398
~~~~
23982399

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+
23992452

24002453
# Type system
24012454

@@ -2702,7 +2755,7 @@ and the cast expression in `main`.
27022755
Within the body of an item that has type parameter declarations, the names of its type parameters are types:
27032756

27042757
~~~~~~~
2705-
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] {
27062759
if xs.len() == 0 { return ~[]; }
27072760
let first: B = f(xs[0]);
27082761
let rest: ~[B] = map(f, xs.slice(1, xs.len()));
@@ -3096,7 +3149,7 @@ communication facilities.
30963149

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

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

0 commit comments

Comments
 (0)