Skip to content

Commit 491735a

Browse files
ericktbrson
authored andcommitted
---
yaml --- r: 4500 b: refs/heads/master c: 491ed7f h: refs/heads/master v: v3
1 parent 8575171 commit 491735a

File tree

9 files changed

+37
-45
lines changed

9 files changed

+37
-45
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8b15045224ff1a0a051e513bc35561abee7a6f65
2+
refs/heads/master: 491ed7f12c2c9adf186599ac5294cb24825ad36b

trunk/src/fuzzer/ast_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std;
22
import std::ivec;
33

4-
fn ivec_equal[T](v: &T[], u: &T[], element_equality_test: fn(&T, &T) -> bool )
4+
fn ivec_equal[T](v: &[T], u: &[T], element_equality_test: fn(&T, &T) -> bool )
55
-> bool {
66
let Lv = ivec::len(v);
77
if Lv != ivec::len(u) { ret false; }
@@ -24,4 +24,4 @@ fn main() {
2424
assert (ivec_equal(~[5, 5], ~[5, 5], builtin_equal));
2525

2626
log_err "Pass";
27-
}
27+
}

trunk/src/fuzzer/fuzzer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn contains(haystack: &str, needle: &str) -> bool {
3838
str::find(haystack, needle) != -1
3939
}
4040

41-
fn find_rust_files(files: &mutable str[], path: str) {
41+
fn find_rust_files(files: &mutable [str], path: str) {
4242
if str::ends_with(path, ".rs") {
4343
if file_contains(path, "xfail-stage1") {
4444
//log_err "Skipping " + path + " because it is marked as xfail-stage1";
@@ -89,10 +89,10 @@ fn safe_to_steal(e: ast::expr_) -> bool {
8989
}
9090
}
9191

92-
fn steal_exprs(crate: &ast::crate) -> ast::expr[] {
93-
let exprs: @mutable ast::expr[] = @mutable ~[];
92+
fn steal_exprs(crate: &ast::crate) -> [ast::expr] {
93+
let exprs: @mutable [ast::expr] = @mutable ~[];
9494
// "Stash" is not type-parameterized because of the need for safe_to_steal
95-
fn stash_expr(es: @mutable ast::expr[], e: &@ast::expr) {
95+
fn stash_expr(es: @mutable [ast::expr], e: &@ast::expr) {
9696
if safe_to_steal(e.node) {
9797
*es += ~[*e];
9898
} else {/* now my indices are wrong :( */ }
@@ -316,7 +316,7 @@ fn check_roundtrip_convergence(code: &str, maxIters: uint) {
316316
}
317317
}
318318

319-
fn check_convergence(files: &str[]) {
319+
fn check_convergence(files: &[str]) {
320320
log_err #fmt("pp convergence tests: %u files", ivec::len(files));
321321
for file in files {
322322
if !file_is_confusing(file) {
@@ -330,7 +330,7 @@ fn check_convergence(files: &str[]) {
330330
}
331331
}
332332

333-
fn check_variants(files: &str[]) {
333+
fn check_variants(files: &[str]) {
334334
for file in files {
335335
if !file_is_confusing(file) {
336336
let s = ioivec::read_whole_file_str(file);

trunk/src/fuzzer/ivec_fuzz.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Idea: provide functions for 'exhaustive' and 'random' modification of vecs.
77
two functions, "return the number of possible edits" and "return edit #n"
88
99
It would be nice if this could be data-driven, so the two functions could share information:
10-
type vec_modifier = rec(fn (&T[] v, uint i) -> T[] fun, uint lo, uint di);
11-
const vec_modifier[] vec_modifiers = ~[rec(fun=vec_omit, 0u, 1u), ...];
10+
type vec_modifier = rec(fn (&[T] v, uint i) -> [T] fun, uint lo, uint di);
11+
const [vec_modifier] vec_modifiers = ~[rec(fun=vec_omit, 0u, 1u), ...];
1212
But that gives me "error: internal compiler error unimplemented consts that's not a plain literal".
1313
https://github.com/graydon/rust/issues/570
1414
@@ -26,24 +26,24 @@ import std::ivec::slice;
2626
import std::ivec::len;
2727
import std::int;
2828

29-
//fn vec_reverse(&T[] v) -> T[] { ... }
29+
//fn vec_reverse(&[T] v) -> [T] { ... }
3030

31-
fn vec_omit[T](v: &T[], i: uint) -> T[] {
31+
fn vec_omit[T](v: &[T], i: uint) -> [T] {
3232
slice(v, 0u, i) + slice(v, i + 1u, len(v))
3333
}
34-
fn vec_dup[T](v: &T[], i: uint) -> T[] {
34+
fn vec_dup[T](v: &[T], i: uint) -> [T] {
3535
slice(v, 0u, i) + ~[v.(i)] + slice(v, i, len(v))
3636
}
37-
fn vec_swadj[T](v: &T[], i: uint) -> T[] {
37+
fn vec_swadj[T](v: &[T], i: uint) -> [T] {
3838
slice(v, 0u, i) + ~[v.(i + 1u), v.(i)] + slice(v, i + 2u, len(v))
3939
}
40-
fn vec_prefix[T](v: &T[], i: uint) -> T[] { slice(v, 0u, i) }
41-
fn vec_suffix[T](v: &T[], i: uint) -> T[] { slice(v, i, len(v)) }
40+
fn vec_prefix[T](v: &[T], i: uint) -> [T] { slice(v, 0u, i) }
41+
fn vec_suffix[T](v: &[T], i: uint) -> [T] { slice(v, i, len(v)) }
4242

43-
fn vec_poke[T](v: &T[], i: uint, x: &T) -> T[] {
43+
fn vec_poke[T](v: &[T], i: uint, x: &T) -> [T] {
4444
slice(v, 0u, i) + ~[x] + slice(v, i + 1u, len(v))
4545
}
46-
fn vec_insert[T](v: &T[], i: uint, x: &T) -> T[] {
46+
fn vec_insert[T](v: &[T], i: uint, x: &T) -> [T] {
4747
slice(v, 0u, i) + ~[x] + slice(v, i, len(v))
4848
}
4949

@@ -54,8 +54,8 @@ iter ix(skip_low: uint, skip_high: uint, length: uint) -> uint {
5454
}
5555

5656
// Returns a bunch of modified versions of v, some of which introduce new elements (borrowed from xs).
57-
fn vec_edits[T](v: &T[], xs: &T[]) -> T[][] {
58-
let edits: T[][] = ~[];
57+
fn vec_edits[T](v: &[T], xs: &[T]) -> [[T]] {
58+
let edits: [[T]] = ~[];
5959
let Lv: uint = len(v);
6060

6161
if Lv != 1u {
@@ -85,7 +85,7 @@ fn vec_edits[T](v: &T[], xs: &T[]) -> T[][] {
8585
}
8686

8787
// Would be nice if this were built in: https://github.com/graydon/rust/issues/424
88-
fn vec_to_str(v: &int[]) -> str {
88+
fn vec_to_str(v: &[int]) -> str {
8989
let i = 0u;
9090
let s = "[";
9191
while i < len(v) {
@@ -96,7 +96,7 @@ fn vec_to_str(v: &int[]) -> str {
9696
ret s + "]";
9797
}
9898

99-
fn show_edits(a: &int[], xs: &int[]) {
99+
fn show_edits(a: &[int], xs: &[int]) {
100100
log_err "=== Edits of " + vec_to_str(a) + " ===";
101101
let b = vec_edits(a, xs);
102102
for each i: uint in ix(0u, 1u, len(b)) { log_err vec_to_str(b.(i)); }
@@ -111,4 +111,4 @@ fn demo_edits() {
111111
show_edits(~[1, 2, 3, 4], xs);
112112
}
113113

114-
fn main() { demo_edits(); }
114+
fn main() { demo_edits(); }

trunk/src/test/pretty/ivec-type.pp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
fn f1(x: [int]) { }
44

55
fn g1() { f1(~[1, 2, 3]); }
6-
7-
fn f2(x: [int]) { }
8-
9-
fn g2() { f2(~[1, 2, 3]); }

trunk/src/test/pretty/ivec-type.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// pp-exact:ivec-type.pp
22

3-
fn f1(x: int[]) { }
3+
fn f1(x: [int]) { }
44

55
fn g1() { f1(~[1, 2, 3]); }
6-
7-
fn f2(x: [int]) { }
8-
9-
fn g2() { f2(~[1, 2, 3]); }

trunk/src/test/run-pass/alloca-from-derived-tydesc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
tag option[T] { some(T); none; }
22

3-
type r[T] = {mutable v: (option[T])[]};
3+
type r[T] = {mutable v: [option[T]]};
44

55
fn f[T]() -> [T] { ret ~[]; }
66

trunk/src/test/run-pass/ivec-tag.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std;
22

3-
fn producer(c: chan[u8[]]) {
3+
fn producer(c: chan[[u8]]) {
44
c <| ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8,
55
8u8, 9u8, 10u8, 11u8, 12u8, 13u8 ];
66
}
77

88
fn main() {
9-
let p: port[u8[]] = port();
9+
let p: port[[u8]] = port();
1010
let prod: task = spawn producer(chan(p));
1111

12-
let data: u8[];
12+
let data: [u8];
1313
p |> data;
1414
}

trunk/src/test/stdtest/either.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ fn test_lefts() {
2727

2828
#[test]
2929
fn test_lefts_none() {
30-
let input: (t[int, int])[] = ~[right(10), right(10)];
30+
let input: [t[int, int]] = ~[right(10), right(10)];
3131
let result = lefts(input);
3232
assert (len(result) == 0u);
3333
}
3434

3535
#[test]
3636
fn test_lefts_empty() {
37-
let input: (t[int, int])[] = ~[];
37+
let input: [t[int, int]] = ~[];
3838
let result = lefts(input);
3939
assert (len(result) == 0u);
4040
}
@@ -48,14 +48,14 @@ fn test_rights() {
4848

4949
#[test]
5050
fn test_rights_none() {
51-
let input: (t[int, int])[] = ~[left(10), left(10)];
51+
let input: [t[int, int]] = ~[left(10), left(10)];
5252
let result = rights(input);
5353
assert (len(result) == 0u);
5454
}
5555

5656
#[test]
5757
fn test_rights_empty() {
58-
let input: (t[int, int])[] = ~[];
58+
let input: [t[int, int]] = ~[];
5959
let result = rights(input);
6060
assert (len(result) == 0u);
6161
}
@@ -73,24 +73,24 @@ fn test_partition() {
7373

7474
#[test]
7575
fn test_partition_no_lefts() {
76-
let input: (t[int, int])[] = ~[right(10), right(11)];
76+
let input: [t[int, int]] = ~[right(10), right(11)];
7777
let result = partition(input);
7878
assert (len(result.lefts) == 0u);
7979
assert (len(result.rights) == 2u);
8080
}
8181

8282
#[test]
8383
fn test_partition_no_rights() {
84-
let input: (t[int, int])[] = ~[left(10), left(11)];
84+
let input: [t[int, int]] = ~[left(10), left(11)];
8585
let result = partition(input);
8686
assert (len(result.lefts) == 2u);
8787
assert (len(result.rights) == 0u);
8888
}
8989

9090
#[test]
9191
fn test_partition_empty() {
92-
let input: (t[int, int])[] = ~[];
92+
let input: [t[int, int]] = ~[];
9393
let result = partition(input);
9494
assert (len(result.lefts) == 0u);
9595
assert (len(result.rights) == 0u);
96-
}
96+
}

0 commit comments

Comments
 (0)