Skip to content

Commit 58ae4f5

Browse files
author
James Miller
committed
---
yaml --- r: 141230 b: refs/heads/try2 c: 5233604 h: refs/heads/master v: v3
1 parent 6352457 commit 58ae4f5

File tree

19 files changed

+656
-550
lines changed

19 files changed

+656
-550
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: 9d37d038fef95408bffadc8701adcd7b5a663894
8+
refs/heads/try2: 523360415cca24ac0cbd198804d797dd05c48559
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ src/.DS_Store
7373
/doc/html
7474
/doc/latex
7575
/doc/std
76-
/doc/extra
7776
/nd/
7877
/llvm/
7978
version.md
@@ -82,6 +81,7 @@ keywords.md
8281
x86_64-apple-darwin/
8382
x86_64-unknown-linux-gnu/
8483
i686-unknown-linux-gnu/
84+
doc/core/
8585
tmp.*.rs
8686
config.stamp
8787
.DS_Store

branches/try2/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
2929
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
3030
# has a frame pointer and the stack walker can understand it. Turning off
3131
# frame pointers everywhere is overkill
32-
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer -DUSE_UTF8
32+
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer
3333

3434
# On Darwin, we need to run dsymutil so the debugging information ends
3535
# up in the right place. On other platforms, it automatically gets

branches/try2/src/libextra/arc.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub impl<'self> Condvar<'self> {
107107
****************************************************************************/
108108

109109
/// An atomically reference counted wrapper for shared immutable state.
110-
pub struct ARC<T> { x: UnsafeAtomicRcBox<T> }
110+
struct ARC<T> { x: UnsafeAtomicRcBox<T> }
111111

112112
/// Create an atomically reference counted wrapper.
113113
pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
@@ -118,22 +118,29 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
118118
* Access the underlying data in an atomically reference counted
119119
* wrapper.
120120
*/
121-
pub impl<T:Const+Owned> ARC<T> {
122-
fn get<'a>(&'a self) -> &'a T {
121+
pub fn get<'a, T:Const + Owned>(rc: &'a ARC<T>) -> &'a T {
122+
rc.get()
123+
}
124+
125+
impl<T:Const+Owned> ARC<T> {
126+
pub fn get<'a>(&'a self) -> &'a T {
123127
unsafe { &*self.x.get_immut() }
124128
}
125129
}
126-
127130
/**
128131
* Duplicate an atomically reference counted wrapper.
129132
*
130133
* The resulting two `arc` objects will point to the same underlying data
131134
* object. However, one of the `arc` objects can be sent to another task,
132135
* allowing them to share the underlying data.
133136
*/
137+
pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
138+
ARC { x: rc.x.clone() }
139+
}
140+
134141
impl<T:Const + Owned> Clone for ARC<T> {
135142
fn clone(&self) -> ARC<T> {
136-
ARC { x: self.x.clone() }
143+
clone(self)
137144
}
138145
}
139146

@@ -505,31 +512,34 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
505512
#[cfg(test)]
506513
mod tests {
507514
use core::prelude::*;
508-
use core::cell::Cell;
515+
509516
use arc::*;
510517
use arc;
511518

519+
use core::cell::Cell;
520+
use core::task;
521+
512522
#[test]
513523
fn manually_share_arc() {
514524
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
515-
let arc_v = ARC(v);
525+
let arc_v = arc::ARC(v);
516526

517527
let (p, c) = comm::stream();
518528

519529
do task::spawn() || {
520530
let p = comm::PortSet::new();
521531
c.send(p.chan());
522532

523-
let arc_v : ARC<~[int]> = p.recv();
533+
let arc_v = p.recv();
524534

525-
let v = copy (*arc_v.get());
535+
let v = copy *arc::get::<~[int]>(&arc_v);
526536
assert_eq!(v[3], 4);
527537
};
528538

529539
let c = p.recv();
530-
c.send(arc_v.clone());
540+
c.send(arc::clone(&arc_v));
531541

532-
assert_eq!(arc_v.get()[2], 3);
542+
assert_eq!((*arc::get(&arc_v))[2], 3);
533543
assert_eq!(arc_v.get()[4], 5);
534544

535545
info!(arc_v);

branches/try2/src/librust/rust.rc

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ extern mod rustc;
3232
use core::prelude::*;
3333

3434
use core::run;
35-
use core::libc::exit;
3635

3736
enum ValidUsage {
38-
Valid(int), Invalid
37+
Valid, Invalid
3938
}
4039

4140
impl ValidUsage {
4241
fn is_valid(&self) -> bool {
4342
match *self {
44-
Valid(_) => true,
45-
Invalid => false
43+
Valid => true,
44+
Invalid => false
4645
}
4746
}
4847
}
@@ -145,7 +144,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
145144
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
146145
UsgCall(f) => f(),
147146
}
148-
Valid(0)
147+
Valid
149148
},
150149
None => Invalid
151150
}
@@ -163,8 +162,8 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
163162
let test_exec = Path(filename).filestem().unwrap() + "test~";
164163
invoke("rustc", &[~"--test", filename.to_owned(),
165164
~"-o", test_exec.to_owned()], rustc::main);
166-
let exit_code = run::run_program(~"./" + test_exec, []);
167-
Valid(exit_code)
165+
run::run_program(~"./" + test_exec, []);
166+
Valid
168167
}
169168
_ => Invalid
170169
}
@@ -176,8 +175,8 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
176175
let exec = Path(filename).filestem().unwrap() + "~";
177176
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
178177
rustc::main);
179-
let exit_code = run::run_program(~"./"+exec, prog_args);
180-
Valid(exit_code)
178+
run::run_program(~"./"+exec, prog_args);
179+
Valid
181180
}
182181
_ => Invalid
183182
}
@@ -195,7 +194,7 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
195194
Call(f) => f(args),
196195
CallMain(prog, f) => {
197196
invoke(prog, args, f);
198-
Valid(0)
197+
Valid
199198
}
200199
}
201200
}
@@ -234,10 +233,7 @@ pub fn main() {
234233
if !args.is_empty() {
235234
for find_cmd(*args.head()).each |command| {
236235
let result = do_command(command, args.tail());
237-
match result {
238-
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
239-
_ => loop
240-
}
236+
if result.is_valid() { return; }
241237
}
242238
}
243239

branches/try2/src/librustc/front/config.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ fn fold_block(
136136
) -> ast::blk_ {
137137
let filtered_stmts =
138138
b.stmts.filter_mapped(|a| filter_stmt(cx, *a));
139-
let filtered_view_items =
140-
b.view_items.filter_mapped(|a| filter_view_item(cx, *a));
141139
ast::blk_ {
142-
view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
140+
view_items: /*bad*/copy b.view_items,
143141
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
144142
expr: b.expr.map(|x| fld.fold_expr(*x)),
145143
id: b.id,

0 commit comments

Comments
 (0)