Skip to content

Commit b9f9acc

Browse files
committed
---
yaml --- r: 13532 b: refs/heads/master c: 976fae8 h: refs/heads/master v: v3
1 parent 3e9362e commit b9f9acc

Some content is hidden

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

61 files changed

+518
-1018
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 52f1904ddde95fb7d8e654b4cc78a4f162385275
2+
refs/heads/master: 976fae80a0fb08057a992fff914fd3995829c6ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/doc/rust.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ h3 a:link, h3 a:visited { color: black; }
5151
.cm-s-default span.cm-bracket {color: #cc7;}
5252
.cm-s-default span.cm-tag {color: #170;}
5353
.cm-s-default span.cm-attribute {color: #00c;}
54+
55+
h1.title {
56+
padding-top: 140px;
57+
background-image: url('http://www.rust-lang.org/logos/rust-logo-128x128-blk.png');
58+
background-repeat: no-repeat;
59+
backround-position: right;
60+
backround-attachment: fixed;
61+
}

trunk/mk/rt.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ RUNTIME_CS_$(1) := \
7070
rt/rust_cc.cpp \
7171
rt/rust_debug.cpp \
7272
rt/rust_box_annihilator.cpp \
73-
rt/rust_cond_lock.cpp \
7473
rt/memory_region.cpp \
7574
rt/boxed_region.cpp \
7675
rt/arch/$$(HOST_$(1))/context.cpp \

trunk/src/cargo/cargo.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,15 @@ fn load_link(mis: [@ast::meta_item]) -> (option<str>,
238238
}
239239

240240
fn load_crate(filename: str) -> option<crate> {
241-
let sess = parse::new_parse_sess(none);
241+
let cm = codemap::new_codemap();
242+
let handler = diagnostic::mk_handler(none);
243+
let sess = @{
244+
cm: cm,
245+
mut next_id: 1,
246+
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
247+
mut chpos: 0u,
248+
mut byte_pos: 0u
249+
};
242250
let c = parse::parse_crate_from_crate_file(filename, [], sess);
243251

244252
let mut name = none;

trunk/src/fuzzer/fuzzer.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,15 @@ fn check_compiling(filename: str) -> happiness {
416416

417417
fn parse_and_print(code: @str) -> str {
418418
let filename = "tmp.rs";
419-
let sess = parse::new_parse_sess(option::none);
419+
let cm = codemap::new_codemap();
420+
let handler = diagnostic::mk_handler(none);
421+
let sess = @{
422+
cm: cm,
423+
mut next_id: 1,
424+
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
425+
mut chpos: 0u,
426+
mut byte_pos: 0u
427+
};
420428
write_file(filename, *code);
421429
let crate = parse::parse_crate_from_source_str(
422430
filename, code, [], sess);
@@ -558,7 +566,15 @@ fn check_variants(files: [str], cx: context) {
558566
}
559567

560568
log(error, "check_variants: " + file);
561-
let sess = parse::new_parse_sess(option::none);
569+
let cm = codemap::new_codemap();
570+
let handler = diagnostic::mk_handler(none);
571+
let sess = @{
572+
cm: cm,
573+
mut next_id: 1,
574+
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
575+
mut chpos: 0u,
576+
mut byte_pos: 0u
577+
};
562578
let crate =
563579
parse::parse_crate_from_source_str(
564580
file,

trunk/src/libcore/core.rc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export float, f32, f64;
3939
export box, char, str, ptr, vec, bool;
4040
export either, option, result, iter;
4141
export libc, os, io, run, rand, sys, unsafe, logging;
42-
export arc, comm, task, future;
42+
export comm, task, future;
4343
export extfmt;
4444
export tuple;
4545
export to_str;
@@ -175,7 +175,6 @@ mod dvec_iter {
175175
}
176176

177177
// Concurrency
178-
mod arc;
179178
mod comm;
180179
mod task;
181180
mod future;

trunk/src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl extensions<A> for dvec<A> {
129129
#[doc = "Overwrite the current contents"]
130130
fn set(+w: [mut A]) {
131131
self.check_not_borrowed();
132-
self.data <- w;
132+
self.data <- w; //FIXME check for recursive use (#2607)
133133
}
134134
}
135135

trunk/src/libcore/extfmt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ mod ct {
9494
}
9595
let mut i = 0u;
9696
while i < lim {
97-
let size = str::utf8_char_width(s[i]);
98-
let curr = str::slice(s, i, i+size);
97+
let curr = str::slice(s, i, i+1u);
9998
if str::eq(curr, "%") {
10099
i += 1u;
101100
if i >= lim {
@@ -111,7 +110,7 @@ mod ct {
111110
pieces += [rs.piece];
112111
i = rs.next;
113112
}
114-
} else { buf += curr; i += size; }
113+
} else { buf += curr; i += 1u; }
115114
}
116115
flush_buf(buf, pieces);
117116
ret pieces;

trunk/src/libcore/sys.rs

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export min_align_of;
77
export pref_align_of;
88
export refcount;
99
export log_str;
10-
export create_lock, lock_and_signal, condition, methods;
1110

1211
enum type_desc = {
1312
first_param: **libc::c_int,
@@ -16,20 +15,11 @@ enum type_desc = {
1615
// Remaining fields not listed
1716
};
1817

19-
type rust_cond_lock = *libc::c_void;
20-
2118
#[abi = "cdecl"]
2219
native mod rustrt {
2320
pure fn refcount(t: *()) -> libc::intptr_t;
2421
fn unsupervise();
2522
pure fn shape_log_str(t: *sys::type_desc, data: *()) -> str;
26-
27-
fn rust_create_cond_lock() -> rust_cond_lock;
28-
fn rust_destroy_cond_lock(lock: rust_cond_lock);
29-
fn rust_lock_cond_lock(lock: rust_cond_lock);
30-
fn rust_unlock_cond_lock(lock: rust_cond_lock);
31-
fn rust_wait_cond_lock(lock: rust_cond_lock);
32-
fn rust_signal_cond_lock(lock: rust_cond_lock) -> bool;
3323
}
3424

3525
#[abi = "rust-intrinsic"]
@@ -84,46 +74,6 @@ pure fn log_str<T>(t: T) -> str {
8474
}
8575
}
8676

87-
resource lock_and_signal(lock: rust_cond_lock) {
88-
rustrt::rust_destroy_cond_lock(lock);
89-
}
90-
91-
enum condition {
92-
condition_(rust_cond_lock)
93-
}
94-
95-
resource unlock(lock: rust_cond_lock) {
96-
rustrt::rust_unlock_cond_lock(lock);
97-
}
98-
99-
fn create_lock() -> lock_and_signal {
100-
lock_and_signal(rustrt::rust_create_cond_lock())
101-
}
102-
103-
impl methods for lock_and_signal {
104-
fn lock<T>(f: fn() -> T) -> T {
105-
rustrt::rust_lock_cond_lock(*self);
106-
let _r = unlock(*self);
107-
f()
108-
}
109-
110-
fn lock_cond<T>(f: fn(condition) -> T) -> T {
111-
rustrt::rust_lock_cond_lock(*self);
112-
let _r = unlock(*self);
113-
f(condition_(*self))
114-
}
115-
}
116-
117-
impl methods for condition {
118-
fn wait() {
119-
rustrt::rust_wait_cond_lock(*self);
120-
}
121-
122-
fn signal() -> bool {
123-
rustrt::rust_signal_cond_lock(*self)
124-
}
125-
}
126-
12777
#[cfg(test)]
12878
mod tests {
12979

@@ -171,26 +121,6 @@ mod tests {
171121
assert pref_align_of::<uint>() == 8u;
172122
assert pref_align_of::<*uint>() == 8u;
173123
}
174-
175-
#[test]
176-
fn condition_variable() {
177-
let lock = arc::arc(create_lock());
178-
let lock2 = arc::clone(&lock);
179-
180-
task::spawn {|move lock2|
181-
let lock = arc::get(&lock2);
182-
(*lock).lock_cond {|c|
183-
c.wait();
184-
}
185-
}
186-
187-
let mut signaled = false;
188-
while !signaled {
189-
(*arc::get(&lock)).lock_cond {|c|
190-
signaled = c.signal()
191-
}
192-
}
193-
}
194124
}
195125

196126
// Local Variables:

trunk/src/libcore/arc.rs renamed to trunk/src/libstd/arc.rs

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
share immutable data between tasks."]
33

44
import comm::{port, chan, methods};
5-
import sys::methods;
65

76
export arc, get, clone, shared_arc, get_arc;
87

9-
export exclusive, methods;
10-
118
#[abi = "cdecl"]
129
native mod rustrt {
1310
#[rust_stack]
@@ -19,12 +16,12 @@ native mod rustrt {
1916
-> libc::intptr_t;
2017
}
2118

22-
type arc_data<T> = {
19+
type arc_data<T: const> = {
2320
mut count: libc::intptr_t,
2421
data: T
2522
};
2623

27-
resource arc_destruct<T>(data: *libc::c_void) {
24+
resource arc_destruct<T: const>(data: *libc::c_void) {
2825
unsafe {
2926
let data: ~arc_data<T> = unsafe::reinterpret_cast(data);
3027
let new_count = rustrt::rust_atomic_decrement(&mut data.count);
@@ -74,46 +71,6 @@ fn clone<T: const>(rc: &arc<T>) -> arc<T> {
7471
arc_destruct(**rc)
7572
}
7673

77-
// An arc over mutable data that is protected by a lock.
78-
type ex_data<T> = {lock: sys::lock_and_signal, data: T};
79-
type exclusive<T> = arc_destruct<ex_data<T>>;
80-
81-
fn exclusive<T>(-data: T) -> exclusive<T> {
82-
let data = ~{mut count: 1, data: {lock: sys::create_lock(),
83-
data: data}};
84-
unsafe {
85-
let ptr = unsafe::reinterpret_cast(data);
86-
unsafe::forget(data);
87-
arc_destruct(ptr)
88-
}
89-
}
90-
91-
impl methods<T> for exclusive<T> {
92-
fn clone() -> exclusive<T> {
93-
unsafe {
94-
// this makes me nervous...
95-
let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(*self);
96-
rustrt::rust_atomic_increment(&mut ptr.count);
97-
unsafe::forget(ptr);
98-
}
99-
arc_destruct(*self)
100-
}
101-
102-
fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
103-
unsafe {
104-
let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(*self);
105-
let r = {
106-
let rec: &ex_data<T> = &(*ptr).data;
107-
rec.lock.lock_cond() {|c|
108-
f(c, &rec.data)
109-
}
110-
};
111-
unsafe::forget(ptr);
112-
r
113-
}
114-
}
115-
}
116-
11774
// Convenience code for sharing arcs between tasks
11875

11976
type get_chan<T: const send> = chan<chan<arc<T>>>;
@@ -158,7 +115,6 @@ fn get_arc<T: send const>(c: get_chan<T>) -> arc::arc<T> {
158115
#[cfg(test)]
159116
mod tests {
160117
import comm::*;
161-
import future::future;
162118

163119
#[test]
164120
fn manually_share_arc() {
@@ -204,31 +160,4 @@ mod tests {
204160

205161
assert p.recv() == ();
206162
}
207-
208-
#[test]
209-
fn exclusive_arc() {
210-
let mut futures = [];
211-
212-
let num_tasks = 10u;
213-
let count = 1000u;
214-
215-
let total = exclusive(~mut 0u);
216-
217-
for uint::range(0u, num_tasks) {|_i|
218-
let total = total.clone();
219-
futures += [future::spawn({||
220-
for uint::range(0u, count) {|_i|
221-
total.with {|_cond, count|
222-
**count += 1u;
223-
}
224-
}
225-
})];
226-
};
227-
228-
for futures.each {|f| f.get() };
229-
230-
total.with {|_cond, total|
231-
assert **total == num_tasks * count
232-
};
233-
}
234163
}

trunk/src/libstd/std.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export net, net_tcp;
1919
export uv, uv_ll, uv_iotask, uv_global_loop;
2020
export c_vec, util, timer;
2121
export bitv, deque, fun_treemap, list, map, smallintmap, sort, treemap;
22-
export rope, arena, par;
22+
export rope, arena, arc, par;
2323
export ebml, dbg, getopts, json, rand, sha1, term, time, prettyprint;
2424
export test, tempfile, serialization;
2525
export cmp;
@@ -69,6 +69,7 @@ mod term;
6969
mod time;
7070
mod prettyprint;
7171
mod arena;
72+
mod arc;
7273
mod par;
7374
mod cmp;
7475

trunk/src/libsyntax/ast.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import std::serialization::{serializer,
1717
deserialize_str,
1818
serialize_bool,
1919
deserialize_bool};
20-
import parse::token;
21-
2220

2321
/* Note #1972 -- spans are serialized but not deserialized */
2422
fn serialize_span<S>(_s: S, _v: span) {
@@ -373,13 +371,6 @@ enum blk_sort {
373371
}
374372
*/
375373

376-
#[auto_serialize]
377-
enum token_tree {
378-
/* for macro invocations; parsing is the macro's job */
379-
tt_delim([token_tree]),
380-
tt_flat(span, token::token)
381-
}
382-
383374
#[auto_serialize]
384375
type mac = spanned<mac_>;
385376

@@ -395,7 +386,6 @@ type mac_body = option<mac_body_>;
395386
#[auto_serialize]
396387
enum mac_ {
397388
mac_invoc(@path, mac_arg, mac_body),
398-
mac_invoc_tt(@path, token_tree), //will kill mac_invoc and steal its name
399389
mac_embed_type(@ty),
400390
mac_embed_block(blk),
401391
mac_ellipsis,

trunk/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
455455
visit_expr: fn@(e: @expr) {
456456
vfn(e.id);
457457
alt e.node {
458-
expr_index(*) | expr_assign_op(*) |
459-
expr_unary(*) | expr_binary(*) {
458+
expr_unary(_, _) | expr_binary(_, _, _) {
460459
vfn(ast_util::op_expr_callee_id(e));
461460
}
462461
_ { /* fallthrough */ }

0 commit comments

Comments
 (0)