Skip to content

Commit 5cbfa4e

Browse files
committed
---
yaml --- r: 53233 b: refs/heads/dist-snap c: f513c56 h: refs/heads/master i: 53231: 436a549 v: v3
1 parent 26df7cc commit 5cbfa4e

File tree

4 files changed

+56
-46
lines changed

4 files changed

+56
-46
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 9ecb8a60ed9737351846eb875107ab3680e9ebd8
10+
refs/heads/dist-snap: f513c567cb5b02a514af3903941434efd0b8a5eb
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
11981198

11991199
tcx.sess.span_err(sp, msg);
12001200

1201-
vec::from_fn(expected_arg_count, |_| ty::mk_err(tcx))
1201+
vec::from_fn(supplied_arg_count, |_| ty::mk_err(tcx))
12021202
};
12031203

12041204
sig.output

branches/dist-snap/src/test/bench/shootout-mandelbrot.rs

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -12,20 +12,17 @@
1212
// http://shootout.alioth.debian.org/
1313
// u64q/program.php?test=mandelbrot&lang=python3&id=2
1414
//
15-
// takes 3 optional args:
15+
// takes 2 optional args:
1616
// square image size, defaults to 80_u
1717
// output path, default is "" (no output), "-" means stdout
18-
// depth (max iterations per pixel), defaults to 50_u
1918
//
20-
// in the shootout, they use 16000 as image size, 50 as depth,
21-
// and write to stdout:
22-
//
23-
// ./shootout_mandelbrot 16000 "-" 50 > /tmp/mandel.pbm
19+
// in the shootout, they use 16000 as image size
2420
//
2521
// writes pbm image to output path
2622

23+
extern mod std;
2724
use io::WriterUtil;
28-
use core::hashmap::linear::LinearMap;
25+
use std::oldmap::HashMap;
2926

3027
struct cmplx {
3128
re: f64,
@@ -57,43 +54,44 @@ pure fn cabs(x: cmplx) -> f64
5754
x.re*x.re + x.im*x.im
5855
}
5956

60-
fn mb(x: cmplx, depth: uint) -> bool
57+
fn mb(x: cmplx) -> bool
6158
{
62-
let mut z = x;
59+
let mut z = cmplx {re: 0f64, im: 0f64};
6360
let mut i = 0;
64-
while i < depth {
65-
if cabs(z) >= 4_f64 {
66-
return false;
67-
}
61+
let mut in = true;
62+
while i < 50 {
6863
z = z*z + x;
64+
if cabs(z) >= 4f64 {
65+
in = false;
66+
break;
67+
}
6968
i += 1;
7069
}
71-
true
70+
in
7271
}
7372

74-
fn fillbyte(x: cmplx, incr: f64, depth: uint) -> u8 {
73+
fn fillbyte(x: cmplx, incr: f64) -> u8 {
7574
let mut rv = 0_u8;
7675
let mut i = 0_u8;
7776
while i < 8_u8 {
7877
let z = cmplx {re: x.re + (i as f64)*incr, im: x.im};
79-
if mb(z, depth) {
78+
if mb(z) {
8079
rv += 1_u8 << (7_u8 - i);
8180
}
8281
i += 1_u8;
8382
}
8483
rv
8584
}
8685

87-
fn chanmb(i: uint, size: uint, depth: uint) -> Line
86+
fn chanmb(i: uint, size: uint) -> Line
8887
{
89-
let bsize = size/8_u;
90-
let mut crv = vec::with_capacity(bsize);
91-
let incr = 2_f64/(size as f64);
92-
let y = incr*(i as f64) - 1_f64;
93-
let xincr = 8_f64*incr;
94-
for uint::range(0_u, bsize) |j| {
95-
let x = cmplx {re: xincr*(j as f64) - 1.5_f64, im: y};
96-
crv.push(fillbyte(x, incr, depth));
88+
let mut crv = ~[];
89+
let incr = 2f64/(size as f64);
90+
let y = incr*(i as f64) - 1f64;
91+
let xincr = 8f64*incr;
92+
for uint::range(0_u, size/8_u) |j| {
93+
let x = cmplx {re: xincr*(j as f64) - 1.5f64, im: y};
94+
crv.push(fillbyte(x, incr));
9795
};
9896
Line {i:i, b:crv}
9997
}
@@ -123,33 +121,34 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
123121
~[io::Create, io::Truncate]))
124122
}
125123
};
126-
cout.write_line("P4");
124+
cout.write_line(~"P4");
127125
cout.write_line(fmt!("%u %u", size, size));
128-
let mut lines: LinearMap<uint, Line> = LinearMap::new();
126+
let lines: HashMap<uint, ~[u8]> = HashMap();
129127
let mut done = 0_u;
130128
let mut i = 0_u;
131129
while i < size {
132130
let aline = pport.recv();
133131
if aline.i == done {
134-
debug!("W %u", done);
132+
debug!("W %u", aline.i);
135133
cout.write(aline.b);
136134
done += 1_u;
137135
let mut prev = done;
138136
while prev <= i {
139-
match lines.pop(&prev) {
140-
Some(pl) => {
141-
debug!("WS %u", prev);
142-
cout.write(pl.b);
143-
done += 1_u;
144-
prev += 1_u;
145-
}
146-
None => break
147-
};
137+
if lines.contains_key(&prev) {
138+
debug!("WS %u", prev);
139+
cout.write(lines.get(&prev));
140+
done += 1_u;
141+
lines.remove(&prev);
142+
prev += 1_u;
143+
}
144+
else {
145+
break
146+
}
148147
};
149148
}
150149
else {
151150
debug!("S %u", aline.i);
152-
lines.insert(aline.i, aline);
151+
lines.insert(aline.i, copy aline.b); // FIXME: bad for perf
153152
};
154153
i += 1_u;
155154
}
@@ -158,14 +157,11 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
158157
fn main() {
159158
let args = os::args();
160159
let args = if os::getenv(~"RUST_BENCH").is_some() {
161-
~[~"", ~"4000", ~"50"]
160+
~[~"", ~"4000"]
162161
} else {
163162
args
164163
};
165164

166-
let depth = if vec::len(args) < 4_u { 50_u }
167-
else { uint::from_str(args[3]).get() };
168-
169165
let path = if vec::len(args) < 3_u { ~"" }
170166
else { copy args[2] }; // FIXME: bad for perf
171167

@@ -176,7 +172,7 @@ fn main() {
176172
let pchan = pipes::SharedChan(pchan);
177173
for uint::range(0_u, size) |j| {
178174
let cchan = pchan.clone();
179-
do task::spawn { cchan.send(chanmb(j, size, depth)) };
175+
do task::spawn || { cchan.send(chanmb(j, size)) };
180176
};
181177
writer(path, pport, size);
182178
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Regresion test for issue #4935
12+
13+
fn foo(a: uint) {}
14+
fn main() { foo(5, 6) } //~ ERROR this function takes 1 parameter but 2 parameters were supplied

0 commit comments

Comments
 (0)