Skip to content

Commit d63040a

Browse files
committed
---
yaml --- r: 42668 b: refs/heads/try c: 19aa88c h: refs/heads/master v: v3
1 parent a5259da commit d63040a

File tree

344 files changed

+7675
-10843
lines changed

Some content is hidden

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

344 files changed

+7675
-10843
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: e447521c1ca2dbead5b485ddc43060b282840817
5+
refs/heads/try: 19aa88cd64c81b77b874f9396a43fedfa28f14ee
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/AUTHORS.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ Other authors:
77

88
Adam Bozanich <[email protected]>
99
Aleksander Balicki <[email protected]>
10-
Alex Crichton <[email protected]>
1110
Alex Rønne Petersen <[email protected]>
1211
Alexander Stavonin <[email protected]>
1312
Andreas Gal <[email protected]>
1413
Andrew Dunham <[email protected]>
1514
Andrew Paseltiner <[email protected]>
1615
Arkaitz Jimenez <[email protected]>
1716
Armin Ronacher <[email protected]>
18-
Ashok Gautham <[email protected]>
1917
Austin Seipp <[email protected]>
2018
2119
Ben Alpert <[email protected]>
@@ -26,7 +24,6 @@ Benjamin Jackman <[email protected]>
2624
Benjamin Kircher <[email protected]>
2725
Benjamin Peterson <[email protected]>
2826
Bilal Husain <[email protected]>
29-
Bill Fallon <[email protected]>
3027
Brendan Eich <[email protected]>
3128
Brian Anderson <[email protected]>
3229
Brian J. Burg <[email protected]>
@@ -91,7 +88,6 @@ Kelly Wilson <[email protected]>
9188
Kevin Atkinson <[email protected]>
9289
Kevin Cantu <[email protected]>
9390
Kyeongwoon Lee <[email protected]>
94-
Laurent Bonnans <[email protected]>
9591
Lennart Kudling <[email protected]>
9692
Lindsey Kuper <[email protected]>
9793
Luca Bruno <[email protected]>
@@ -131,7 +127,6 @@ Sean Stangl <[email protected]>
131127
Sebastian N. Fernandez <[email protected]>
132128
Seo Sanghyeon <[email protected]>
133129
Simon Barber-Dueck <[email protected]>
134-
Simon Sapin <[email protected]>
135130
startling <[email protected]>
136131
Stefan Plantikow <[email protected]>
137132
Steve Klabnik <[email protected]>
@@ -148,5 +143,4 @@ Vincent Belliard <[email protected]>
148143
Wade Mealing <[email protected]>
149144
William Ting <[email protected]>
150145
Yasuhiro Fujii <[email protected]>
151-
Youngsoo Son <[email protected]>
152146
Zack Corr <[email protected]>

branches/try/doc/rust.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ let log loop
222222
match mod move mut
223223
priv pub pure
224224
ref return
225-
self static struct super
225+
self static struct
226226
true trait type
227227
unsafe use
228228
while
@@ -594,16 +594,16 @@ and may optionally begin with any number of `attributes` that apply to the conta
594594
Atributes on the anonymous crate module define important metadata that influences
595595
the behavior of the compiler.
596596

597-
~~~~~~~~
597+
~~~~~~~~{.xfail-test}
598598
// Linkage attributes
599-
#[ link(name = "projx",
599+
#[ link(name = "projx"
600600
vers = "2.5",
601601
uuid = "9cccc5d5-aceb-4af5-8285-811211826b82") ];
602602
603603
// Additional metadata attributes
604-
#[ desc = "Project X" ];
605-
#[ license = "BSD" ];
606-
#[ author = "Jane Doe" ];
604+
#[ desc = "Project X",
605+
license = "BSD" ];
606+
author = "Jane Doe" ];
607607
608608
// Specify the output type
609609
#[ crate_type = "lib" ];
@@ -2472,7 +2472,7 @@ disabled dynamically at run-time on a per-task and per-item basis. See
24722472
Each `log` expression must be provided with a *level* argument in
24732473
addition to the value to log. The logging level is a `u32` value, where
24742474
lower levels indicate more-urgent levels of logging. By default, the lowest
2475-
four logging levels (`1_u32 ... 4_u32`) are predefined as the constants
2475+
four logging levels (`0_u32 ... 3_u32`) are predefined as the constants
24762476
`error`, `warn`, `info` and `debug` in the `core` library.
24772477

24782478
Additionally, the macros `error!`, `warn!`, `info!` and `debug!` are defined
@@ -3018,11 +3018,6 @@ Local variables are immutable unless declared with `let mut`. The
30183018
declaration (so `let mut x, y` declares two mutable variables, `x` and
30193019
`y`).
30203020

3021-
Function parameters are immutable unless declared with `mut`. The
3022-
`mut` keyword applies only to the following parameter (so `|mut x, y|`
3023-
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
3024-
one immutable variable `y`).
3025-
30263021
Local variables are not initialized when allocated; the entire frame worth of
30273022
local variables are allocated at once, on frame-entry, in an uninitialized
30283023
state. Subsequent statements within a function may or may not initialize the
@@ -3247,10 +3242,10 @@ level will be output to the console.
32473242
The path to a module consists of the crate name, any parent modules,
32483243
then the module itself, all separated by double colons (`::`). The
32493244
optional log level can be appended to the module path with an equals
3250-
sign (`=`) followed by the log level, from 1 to 4, inclusive. Level 1
3251-
is the error level, 2 is warning, 3 info, and 4 debug. Any logs
3245+
sign (`=`) followed by the log level, from 0 to 3, inclusive. Level 0
3246+
is the error level, 1 is warning, 2 info, and 3 debug. Any logs
32523247
less than or equal to the specified level will be output. If not
3253-
specified then log level 4 is assumed.
3248+
specified then log level 3 is assumed.
32543249

32553250
As an example, to see all the logs generated by the compiler, you would set
32563251
`RUST_LOG` to `rustc`, which is the crate name (as specified in its `link`

branches/try/doc/tutorial-ffi.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ fn as_hex(data: ~[u8]) -> ~str {
2626
return acc;
2727
}
2828
29-
fn sha1(data: ~str) -> ~str {
30-
unsafe {
31-
let bytes = str::to_bytes(data);
32-
let hash = crypto::SHA1(vec::raw::to_ptr(bytes),
33-
vec::len(bytes) as c_uint,
34-
ptr::null());
35-
return as_hex(vec::from_buf(hash, 20));
36-
}
29+
fn sha1(data: ~str) -> ~str unsafe {
30+
let bytes = str::to_bytes(data);
31+
let hash = crypto::SHA1(vec::raw::to_ptr(bytes),
32+
vec::len(bytes) as c_uint, ptr::null());
33+
return as_hex(vec::from_buf(hash, 20));
3734
}
3835
3936
fn main() {
@@ -228,15 +225,13 @@ struct timeval {
228225
extern mod lib_c {
229226
fn gettimeofday(tv: *timeval, tz: *()) -> i32;
230227
}
231-
fn unix_time_in_microseconds() -> u64 {
232-
unsafe {
233-
let x = timeval {
234-
mut tv_sec: 0 as c_ulonglong,
235-
mut tv_usec: 0 as c_ulonglong
236-
};
237-
lib_c::gettimeofday(ptr::addr_of(&x), ptr::null());
238-
return (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
239-
}
228+
fn unix_time_in_microseconds() -> u64 unsafe {
229+
let x = timeval {
230+
mut tv_sec: 0 as c_ulonglong,
231+
mut tv_usec: 0 as c_ulonglong
232+
};
233+
lib_c::gettimeofday(ptr::addr_of(&x), ptr::null());
234+
return (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
240235
}
241236
242237
# fn main() { assert fmt!("%?", unix_time_in_microseconds()) != ~""; }

branches/try/doc/tutorial-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ let result = port.recv();
220220
The `Port` and `Chan` pair created by `stream` enables efficient communication
221221
between a single sender and a single receiver, but multiple senders cannot use
222222
a single `Chan`, and multiple receivers cannot use a single `Port`. What if our
223-
example needed to compute multiple results across a number of tasks? The
223+
example needed to computer multiple results across a number of tasks? The
224224
following program is ill-typed:
225225

226226
~~~ {.xfail-test}

branches/try/doc/tutorial.md

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -863,34 +863,11 @@ allocating memory and indirecting through a pointer. But for big structs, or
863863
those with mutable fields, it can be useful to have a single copy on
864864
the stack or on the heap, and refer to that through a pointer.
865865

866-
Whenever memory is allocated on the heap, the program needs a strategy to
867-
dispose of the memory when no longer needed. Most languages, such as Java or
868-
Python, use *garbage collection* for this, a strategy in which the program
869-
periodically searches for allocations that are no longer reachable in order
870-
to dispose of them. Other languages, such as C, use *manual memory
871-
management*, which relies on the programmer to specify when memory should be
872-
reclaimed.
873-
874-
Rust is in a different position. It differs from the garbage-collected
875-
environments in that allows the programmer to choose the disposal
876-
strategy on an object-by-object basis. Not only does this have benefits for
877-
performance, but we will later see that this model has benefits for
878-
concurrency as well, by making it possible for the Rust compiler to detect
879-
data races at compile time. Rust also differs from the manually managed
880-
languages in that it is *safe*—it uses a [pointer lifetime
881-
analysis][borrow] to ensure that manual memory management cannot cause memory
882-
errors at runtime.
883-
884-
[borrow]: tutorial-borrowed-ptr.html
885-
886-
The cornerstone of Rust's memory management is the concept of a *smart
887-
pointer*—a pointer type that indicates the lifetime of the object it points
888-
to. This solution is familiar to C++ programmers; Rust differs from C++,
889-
however, in that a small set of smart pointers are built into the language.
890-
The safe pointer types are `@T`, for *managed* boxes allocated on the *local
891-
heap*, `~T`, for *uniquely-owned* boxes allocated on the *exchange
892-
heap*, and `&T`, for *borrowed* pointers, which may point to any memory, and
893-
whose lifetimes are governed by the call stack.
866+
Rust supports several types of pointers. The safe pointer types are
867+
`@T`, for managed boxes allocated on the local heap, `~T`, for
868+
uniquely-owned boxes allocated on the exchange heap, and `&T`, for
869+
borrowed pointers, which may point to any memory, and whose lifetimes
870+
are governed by the call stack.
894871

895872
All pointer types can be dereferenced with the `*` unary operator.
896873

@@ -942,17 +919,7 @@ node2.next = SomeNode(node3);
942919
node3.prev = SomeNode(node2);
943920
~~~
944921

945-
Managed boxes never cross task boundaries. This has several benefits for
946-
performance:
947-
948-
* The Rust garbage collector does not need to stop multiple threads in order
949-
to collect garbage.
950-
951-
* You can separate your application into "real-time" tasks that do not use
952-
the garbage collector and "non-real-time" tasks that do, and the real-time
953-
tasks will not be interrupted by the non-real-time tasks.
954-
955-
C++ programmers will recognize `@T` as similar to `std::shared_ptr<T>`.
922+
Managed boxes never cross task boundaries.
956923

957924
> ***Note:*** Currently, the Rust compiler generates code to reclaim
958925
> managed boxes through reference counting and a cycle collector, but
@@ -989,19 +956,10 @@ let z = *x + *y;
989956
assert z == 20;
990957
~~~~
991958

992-
When they do not contain any managed boxes, owned boxes can be sent
993-
to other tasks. The sending task will give up ownership of the box
959+
Owned boxes, when they do not contain any managed boxes, can be sent
960+
to other tasks. The sending task will give up ownership of the box,
994961
and won't be able to access it afterwards. The receiving task will
995-
become the sole owner of the box. This prevents *data races*—errors
996-
that could otherwise result from multiple tasks working on the same
997-
data without synchronization.
998-
999-
When an owned pointer goes out of scope or is overwritten, the object
1000-
it points to is immediately freed. Effective use of owned boxes can
1001-
therefore be an efficient alternative to garbage collection.
1002-
1003-
C++ programmers will recognize `~T` as similar to `std::unique_ptr<T>`
1004-
(or `std::auto_ptr<T>` in C++03 and below).
962+
become the sole owner of the box.
1005963

1006964
## Borrowed pointers
1007965

@@ -1226,18 +1184,6 @@ match crayons[0] {
12261184
}
12271185
~~~~
12281186
1229-
A vector can be destructured using pattern matching:
1230-
1231-
~~~~
1232-
let numbers: [int * 3] = [1, 2, 3];
1233-
let score = match numbers {
1234-
[] => 0,
1235-
[a] => a * 10,
1236-
[a, b] => a * 6 + b * 4,
1237-
[a, b, c, ..rest] => a * 5 + b * 3 + c * 2 + rest.len() as int
1238-
};
1239-
~~~~
1240-
12411187
The elements of a vector _inherit the mutability of the vector_,
12421188
and as such, individual elements may not be reassigned when the
12431189
vector lives in an immutable slot.
@@ -2405,7 +2351,7 @@ override the name used to search for the crate.
24052351

24062352
Our example crate declared this set of `link` attributes:
24072353

2408-
~~~~
2354+
~~~~ {.xfail-test}
24092355
#[link(name = "farm", vers = "2.5", author = "mjh")];
24102356
~~~~
24112357

branches/try/src/compiletest/compiletest.rc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,17 @@ fn run_tests(config: config) {
158158
}
159159

160160
fn test_opts(config: config) -> test::TestOpts {
161-
test::TestOpts {
162-
filter: config.filter,
163-
run_ignored: config.run_ignored,
164-
logfile: config.logfile.map(|s| s.to_str()),
161+
{filter:
162+
match config.filter {
163+
option::Some(s) => option::Some(s),
164+
option::None => option::None
165+
},
166+
run_ignored: config.run_ignored,
167+
logfile:
168+
match config.logfile {
169+
option::Some(s) => option::Some(s.to_str()),
170+
option::None => option::None
171+
}
165172
}
166173
}
167174

branches/try/src/compiletest/errors.rs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,34 @@ fn load_errors(testfile: &Path) -> ~[expected_error] {
3333
return error_patterns;
3434
}
3535

36-
fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] {
37-
unsafe {
38-
let error_tag = ~"//~";
39-
let mut idx;
40-
match str::find_str(line, error_tag) {
41-
None => return ~[],
42-
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
43-
}
36+
fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
37+
let error_tag = ~"//~";
38+
let mut idx;
39+
match str::find_str(line, error_tag) {
40+
None => return ~[],
41+
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
42+
}
4443

45-
// "//~^^^ kind msg" denotes a message expected
46-
// three lines above current line:
47-
let mut adjust_line = 0u;
48-
let len = str::len(line);
49-
while idx < len && line[idx] == ('^' as u8) {
50-
adjust_line += 1u;
51-
idx += 1u;
52-
}
44+
// "//~^^^ kind msg" denotes a message expected
45+
// three lines above current line:
46+
let mut adjust_line = 0u;
47+
let len = str::len(line);
48+
while idx < len && line[idx] == ('^' as u8) {
49+
adjust_line += 1u;
50+
idx += 1u;
51+
}
5352

54-
// Extract kind:
55-
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
56-
let start_kind = idx;
57-
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
58-
let kind = str::to_lower(str::slice(line, start_kind, idx));
53+
// Extract kind:
54+
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
55+
let start_kind = idx;
56+
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
57+
let kind = str::to_lower(str::slice(line, start_kind, idx));
5958

60-
// Extract msg:
61-
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
62-
let msg = str::slice(line, idx, len);
59+
// Extract msg:
60+
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
61+
let msg = str::slice(line, idx, len);
6362

64-
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
63+
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
6564

66-
return ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
67-
}
65+
return ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
6866
}

branches/try/src/compiletest/header.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,15 @@ fn parse_name_directive(line: ~str, directive: ~str) -> bool {
146146
}
147147

148148
fn parse_name_value_directive(line: ~str,
149-
directive: ~str) -> Option<~str> {
150-
unsafe {
151-
let keycolon = directive + ~":";
152-
match str::find_str(line, keycolon) {
153-
Some(colon) => {
154-
let value = str::slice(line, colon + str::len(keycolon),
155-
str::len(line));
156-
debug!("%s: %s", directive, value);
157-
Some(value)
158-
}
159-
None => None
149+
directive: ~str) -> Option<~str> unsafe {
150+
let keycolon = directive + ~":";
151+
match str::find_str(line, keycolon) {
152+
Some(colon) => {
153+
let value = str::slice(line, colon + str::len(keycolon),
154+
str::len(line));
155+
debug!("%s: %s", directive, value);
156+
Some(value)
160157
}
158+
None => None
161159
}
162160
}

0 commit comments

Comments
 (0)