Skip to content

Commit 1a0e532

Browse files
committed
---
yaml --- r: 30522 b: refs/heads/incoming c: b776395 h: refs/heads/master v: v3
1 parent 8f16eba commit 1a0e532

File tree

14 files changed

+60
-87
lines changed

14 files changed

+60
-87
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 62b51d9152e3289c8054792035ea63088247fead
9+
refs/heads/incoming: b776395263bfc9908d8fec80d7d1d0f67b8490e8
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/cargo/cargo.rs

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::{map, json, tempfile, term, sort, getopts};
1313
use map::HashMap;
1414
use to_str::to_str;
1515
use getopts::{optflag, optopt, opt_present};
16+
use dvec::DVec;
1617

1718
type package = {
1819
name: ~str,
@@ -60,7 +61,7 @@ type source = @{
6061
mut method: ~str,
6162
mut key: Option<~str>,
6263
mut keyfp: Option<~str>,
63-
mut packages: ~[mut package]
64+
packages: DVec<package>
6465
};
6566

6667
type cargo = {
@@ -448,7 +449,7 @@ fn parse_source(name: ~str, j: json::Json) -> source {
448449
mut method: method,
449450
mut key: key,
450451
mut keyfp: keyfp,
451-
mut packages: ~[mut] };
452+
packages: DVec() };
452453
}
453454
_ => fail ~"needed dict value in source"
454455
};
@@ -558,14 +559,14 @@ fn load_one_source_package(src: source, p: map::HashMap<~str, json::Json>) {
558559
versions: ~[]
559560
};
560561

561-
match vec::position(src.packages, |pkg| pkg.uuid == uuid) {
562-
Some(idx) => {
563-
src.packages[idx] = newpkg;
564-
log(debug, ~" updated package: " + src.name + ~"/" + name);
565-
}
566-
None => {
567-
vec::grow(src.packages, 1u, newpkg);
568-
}
562+
match src.packages.position(|pkg| pkg.uuid == uuid) {
563+
Some(idx) => {
564+
src.packages.set_elt(idx, newpkg);
565+
log(debug, ~" updated package: " + src.name + ~"/" + name);
566+
}
567+
None => {
568+
src.packages.push(newpkg);
569+
}
569570
}
570571
571572
log(debug, ~" loaded package: " + src.name + ~"/" + name);
@@ -713,10 +714,7 @@ fn configure(opts: options) -> cargo {
713714

714715
fn for_each_package(c: cargo, b: fn(source, package)) {
715716
for c.sources.each_value |v| {
716-
// FIXME (#2280): this temporary shouldn't be
717-
// necessary, but seems to be, for borrowing.
718-
let pks = copy v.packages;
719-
for vec::each(pks) |p| {
717+
for v.packages.each |p| {
720718
b(v, p);
721719
}
722720
}
@@ -948,30 +946,28 @@ fn install_named(c: cargo, wd: &Path, name: ~str) {
948946

949947
fn install_uuid_specific(c: cargo, wd: &Path, src: ~str, uuid: ~str) {
950948
match c.sources.find(src) {
951-
Some(s) => {
952-
let packages = copy s.packages;
953-
if vec::any(packages, |p| {
954-
if p.uuid == uuid {
955-
install_package(c, src, wd, p);
956-
true
957-
} else { false }
958-
}) { return; }
959-
}
960-
_ => ()
949+
Some(s) => {
950+
for s.packages.each |p| {
951+
if p.uuid == uuid {
952+
install_package(c, src, wd, p);
953+
return;
954+
}
955+
}
956+
}
957+
_ => ()
961958
}
962959
error(~"can't find package: " + src + ~"/" + uuid);
963960
}
964961

965962
fn install_named_specific(c: cargo, wd: &Path, src: ~str, name: ~str) {
966963
match c.sources.find(src) {
967964
Some(s) => {
968-
let packages = copy s.packages;
969-
if vec::any(packages, |p| {
965+
for s.packages.each |p| {
970966
if p.name == name {
971967
install_package(c, src, wd, p);
972-
true
973-
} else { false }
974-
}) { return; }
968+
return;
969+
}
970+
}
975971
}
976972
_ => ()
977973
}
@@ -1500,8 +1496,7 @@ fn print_pkg(s: source, p: package) {
15001496
fn print_source(s: source) {
15011497
info(s.name + ~" (" + s.url + ~")");
15021498

1503-
let unsorted_pks = s.packages; // to prevent illegal borrow?
1504-
let pks = sort::merge_sort(sys::shape_lt, unsorted_pks);
1499+
let pks = sort::merge_sort(sys::shape_lt, s.packages.get());
15051500
let l = vec::len(pks);
15061501

15071502
print(io::with_str_writer(|writer| {
@@ -1685,7 +1680,7 @@ fn cmd_sources(c: cargo) {
16851680
mut method: assume_source_method(url),
16861681
mut key: None,
16871682
mut keyfp: None,
1688-
mut packages: ~[mut]
1683+
packages: DVec()
16891684
});
16901685
info(fmt!("added source: %s", name));
16911686
}

branches/incoming/src/libcore/iter-trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
1818
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B {
1919
iter::foldl(self, move b0, blk)
2020
}
21+
pure fn position(f: fn(A) -> bool) -> Option<uint> {
22+
iter::position(self, f)
23+
}
2124
}
2225

2326
impl<A: Eq> IMPL_T<A>: iter::EqIter<A> {
2427
pure fn contains(x: A) -> bool { iter::contains(self, x) }
2528
pure fn count(x: A) -> uint { iter::count(self, x) }
26-
pure fn position(f: fn(A) -> bool) -> Option<uint> {
27-
iter::position(self, f)
28-
}
2929
}
3030

3131
impl<A: Copy> IMPL_T<A>: iter::CopyableIter<A> {

branches/incoming/src/libcore/iter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ trait ExtendedIter<A> {
1313
pure fn all(blk: fn(A) -> bool) -> bool;
1414
pure fn any(blk: fn(A) -> bool) -> bool;
1515
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B;
16+
pure fn position(f: fn(A) -> bool) -> Option<uint>;
1617
}
1718

1819
trait EqIter<A:Eq> {
1920
pure fn contains(x: A) -> bool;
2021
pure fn count(x: A) -> uint;
21-
pure fn position(f: fn(A) -> bool) -> Option<uint>;
2222
}
2323

2424
trait Times {
@@ -142,7 +142,8 @@ pure fn count<A:Eq,IA:BaseIter<A>>(self: IA, x: A) -> uint {
142142
}
143143

144144
pure fn position<A,IA:BaseIter<A>>(self: IA, f: fn(A) -> bool)
145-
-> Option<uint> {
145+
-> Option<uint>
146+
{
146147
let mut i = 0;
147148
for self.each |a| {
148149
if f(a) { return Some(i); }

branches/incoming/src/libcore/repr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl ReprPrinterWrapper {
184184
self.printer.ptr = transmute(&(*box).data);
185185
intrinsic::visit_tydesc((*box).type_desc, self as @TyVisitor);
186186
let box_size = sys::size_of::<*BoxRepr>();
187-
self.printer.ptr = transmute(self.printer.ptr as uint + box_size);
187+
self.printer.ptr = transmute(box_ptr as uint + box_size);
188188
true
189189
}
190190
}
@@ -200,7 +200,7 @@ impl ReprPrinterWrapper {
200200
intrinsic::visit_tydesc(inner, self as @TyVisitor);
201201
}
202202
let ptr_size = sys::size_of::<*c_void>();
203-
self.printer.ptr = transmute(self.printer.ptr as uint + ptr_size);
203+
self.printer.ptr = transmute(data_ptr as uint + ptr_size);
204204
true
205205
}
206206
}
@@ -508,7 +508,7 @@ impl ReprPrinterWrapper : TyVisitor {
508508
_disr_val: int,
509509
n_fields: uint,
510510
_name: &str) -> bool {
511-
if !self.printer.skip && n_fields > 1 {
511+
if !self.printer.skip && n_fields >= 1 {
512512
self.printer.writer.write_char(')');
513513
}
514514
true

branches/incoming/src/libcore/rt.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ extern mod rustrt {
3333
// FIXME (#2861): This needs both the attribute, and the name prefixed with
3434
// 'rt_', otherwise the compiler won't find it. To fix this, see
3535
// gather_rust_rtcalls.
36-
#[rt(fail)]
37-
fn rt_fail(expr: *c_char, file: *c_char, line: size_t) {
38-
cleanup_stack_for_failure();
39-
rustrt::rust_upcall_fail(expr, file, line);
40-
}
41-
4236
#[rt(fail_)]
4337
fn rt_fail_(expr: *c_char, file: *c_char, line: size_t) {
4438
cleanup_stack_for_failure();

branches/incoming/src/libcore/task.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,9 +1403,11 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) {
14031403

14041404
let num_threads = match opts.mode {
14051405
SingleThreaded => 1u,
1406-
ThreadPerCore => rustrt::rust_num_threads(),
1406+
ThreadPerCore => {
1407+
fail ~"thread_per_core scheduling mode unimplemented"
1408+
}
14071409
ThreadPerTask => {
1408-
fail ~"ThreadPerTask scheduling mode unimplemented"
1410+
fail ~"thread_per_task scheduling mode unimplemented"
14091411
}
14101412
ManualThreads(threads) => {
14111413
if threads == 0u {
@@ -1655,8 +1657,6 @@ extern mod rustrt {
16551657

16561658
fn rust_get_sched_id() -> sched_id;
16571659
fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
1658-
fn sched_threads() -> libc::size_t;
1659-
fn rust_num_threads() -> libc::uintptr_t;
16601660

16611661
fn get_task_id() -> task_id;
16621662
#[rust_stack]
@@ -2422,13 +2422,3 @@ fn test_tls_cleanup_on_failure() unsafe {
24222422
local_data_set(int_key, @31337);
24232423
fail;
24242424
}
2425-
2426-
#[test]
2427-
fn test_sched_thread_per_core() {
2428-
let cores = rustrt::rust_num_threads();
2429-
let mut reported_threads = 0u;
2430-
do spawn_sched(ThreadPerCore) {
2431-
reported_threads = rustrt::sched_threads();
2432-
}
2433-
assert(cores == reported_threads);
2434-
}

branches/incoming/src/libcore/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,14 +2019,14 @@ impl<A> &[A]: iter::ExtendedIter<A> {
20192019
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B {
20202020
iter::foldl(self, move b0, blk)
20212021
}
2022+
pure fn position(f: fn(A) -> bool) -> Option<uint> {
2023+
iter::position(self, f)
2024+
}
20222025
}
20232026

20242027
impl<A: Eq> &[A]: iter::EqIter<A> {
20252028
pure fn contains(x: A) -> bool { iter::contains(self, x) }
20262029
pure fn count(x: A) -> uint { iter::count(self, x) }
2027-
pure fn position(f: fn(A) -> bool) -> Option<uint> {
2028-
iter::position(self, f)
2029-
}
20302030
}
20312031

20322032
impl<A: Copy> &[A]: iter::CopyableIter<A> {

branches/incoming/src/rt/rust_builtin.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,6 @@ rust_get_sched_id() {
572572
return task->sched->get_id();
573573
}
574574

575-
extern "C" CDECL uintptr_t
576-
rust_num_threads() {
577-
rust_task *task = rust_get_current_task();
578-
return task->kernel->env->num_sched_threads;
579-
}
580-
581575
extern "C" CDECL rust_sched_id
582576
rust_new_sched(uintptr_t threads) {
583577
rust_task *task = rust_get_current_task();
@@ -626,7 +620,7 @@ start_task(rust_task *target, fn_env_pair *f) {
626620
target->start(f->f, f->env, NULL);
627621
}
628622

629-
extern "C" CDECL size_t
623+
extern "C" CDECL int
630624
sched_threads() {
631625
rust_task *task = rust_get_current_task();
632626
return task->sched->number_of_threads();

branches/incoming/src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ rand_seed
3232
rust_get_sched_id
3333
rust_new_sched
3434
rust_new_task_in_sched
35-
rust_num_threads
3635
rust_path_is_dir
3736
rust_path_exists
3837
rust_getcwd

branches/incoming/src/rustc/middle/trans/base.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,16 +2714,6 @@ fn trans_crate(sess: session::session,
27142714
io::println(fmt!("n_monos: %u", ccx.stats.n_monos));
27152715
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines));
27162716
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
2717-
2718-
// FIXME (#2280): this temporary shouldn't be
2719-
// necessary, but seems to be, for borrowing.
2720-
/*
2721-
let times = copy *ccx.stats.fn_times;
2722-
for vec::each(times) |timing| {
2723-
io::println(fmt!("time: %s took %d ms", timing.ident,
2724-
timing.time));
2725-
}
2726-
*/
27272717
}
27282718

27292719
if ccx.sess.count_llvm_insns() {

branches/incoming/src/snapshots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2012-09-12 fa74edf
2+
macos-i386 da38aa39fd1515ea765790a3c320194bc50fd602
3+
macos-x86_64 7509861e5a6d3e082ad9a9d3474661856b7731c1
4+
freebsd-x86_64 c4e0517d6894d18342eb852b6e738f48d086004f
5+
linux-i386 ee0d36b221d8d2dbb02cd1fd1feb09294e0dbb6f
6+
linux-x86_64 ce585fd55ae42e33398870c3bc77a671547411aa
7+
winnt-i386 5b32231d75d65c057ccd91a6f810e67941f5400a
8+
19
S 2012-09-12 8fbe4b5
210
macos-x86_64 bdbd0feff0391b902ea0a0c68948962c0acf5dae
311
macos-i386 c7e0da4ffb778045f77b84878872dc3944d147da

branches/incoming/src/test/bench/shootout-mandelbrot.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
118118
};
119119
cout.write_line(~"P4");
120120
cout.write_line(fmt!("%u %u", size, size));
121-
let lines = std::map::uint_hash();
121+
let lines: HashMap<uint, ~[u8]> = std::map::uint_hash();
122122
let mut done = 0_u;
123123
let mut i = 0_u;
124124
while i < size {
@@ -131,10 +131,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
131131
while prev <= i {
132132
if lines.contains_key(prev) {
133133
debug!("WS %u", prev);
134-
// FIXME (#2280): this temporary shouldn't be
135-
// necessary, but seems to be, for borrowing.
136-
let v : ~[u8] = lines.get(prev);
137-
cout.write(v);
134+
cout.write(lines.get(prev));
138135
done += 1_u;
139136
lines.remove(prev);
140137
prev += 1_u;

branches/incoming/src/test/run-pass/log-knows-the-names-of-variants.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ enum foo {
44
c,
55
}
66

7+
enum bar {
8+
d, e, f
9+
}
10+
711
fn main() {
812
assert ~"a(22)" == fmt!("%?", a(22u));
913
assert ~"b(~\"hi\")" == fmt!("%?", b(~"hi"));
1014
assert ~"c" == fmt!("%?", c);
15+
assert ~"d" == fmt!("%?", d);
1116
}

0 commit comments

Comments
 (0)