Skip to content

Commit dd38af2

Browse files
committed
compiletest: Allow legacy records
But also remove most uses of structural records.
1 parent c5461e4 commit dd38af2

File tree

5 files changed

+103
-100
lines changed

5 files changed

+103
-100
lines changed

src/compiletest/compiletest.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#[no_core];
1414
#[legacy_exports];
15+
#[legacy_records];
1516

1617
#[allow(vecs_implicitly_copyable)];
1718
#[allow(non_camel_case_types)];

src/compiletest/errors.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ use io::ReaderUtil;
1616
use str;
1717

1818
export load_errors;
19-
export expected_error;
19+
export ExpectedError;
2020

21-
type expected_error = { line: uint, kind: ~str, msg: ~str };
21+
struct ExpectedError { line: uint, kind: ~str, msg: ~str }
2222

2323
// Load any test directives embedded in the file
24-
fn load_errors(testfile: &Path) -> ~[expected_error] {
24+
fn load_errors(testfile: &Path) -> ~[ExpectedError] {
2525
let mut error_patterns = ~[];
2626
let rdr = io::file_reader(testfile).get();
2727
let mut line_num = 1u;
@@ -33,7 +33,7 @@ fn load_errors(testfile: &Path) -> ~[expected_error] {
3333
return error_patterns;
3434
}
3535

36-
fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] {
36+
fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
3737
unsafe {
3838
let error_tag = ~"//~";
3939
let mut idx;
@@ -63,6 +63,7 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] {
6363

6464
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
6565

66-
return ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
66+
return ~[ExpectedError{line: line_num - adjust_line, kind: kind,
67+
msg: msg}];
6768
}
6869
}

src/compiletest/header.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use io::ReaderUtil;
1717
use os;
1818
use str;
1919

20-
export test_props;
20+
export TestProps;
2121
export load_props;
2222
export is_test_ignored;
2323

24-
type test_props = {
24+
struct TestProps {
2525
// Lines that should be expected, in order, on standard out
2626
error_patterns: ~[~str],
2727
// Extra flags to pass to the compiler
@@ -33,10 +33,10 @@ type test_props = {
3333
aux_builds: ~[~str],
3434
// Environment settings to use during execution
3535
exec_env: ~[(~str,~str)]
36-
};
36+
}
3737

3838
// Load any test directives embedded in the file
39-
fn load_props(testfile: &Path) -> test_props {
39+
fn load_props(testfile: &Path) -> TestProps {
4040
let mut error_patterns = ~[];
4141
let mut aux_builds = ~[];
4242
let mut exec_env = ~[];
@@ -64,7 +64,7 @@ fn load_props(testfile: &Path) -> test_props {
6464
exec_env.push(*ee);
6565
}
6666
};
67-
return {
67+
return TestProps {
6868
error_patterns: error_patterns,
6969
compile_flags: compile_flags,
7070
pp_exact: pp_exact,

src/compiletest/procsrv.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ fn target_env(_lib_path: ~str, _prog: ~str) -> ~[(~str,~str)] {
5151
~[]
5252
}
5353

54+
struct Result {status: int, out: ~str, err: ~str}
5455

5556
// FIXME (#2659): This code is duplicated in core::run::program_output
5657
fn run(lib_path: ~str,
5758
prog: ~str,
5859
args: ~[~str],
5960
env: ~[(~str, ~str)],
60-
input: Option<~str>) -> {status: int, out: ~str, err: ~str} {
61+
input: Option<~str>) -> Result {
6162

6263
let pipe_in = os::pipe();
6364
let pipe_out = os::pipe();
@@ -105,7 +106,7 @@ fn run(lib_path: ~str,
105106
};
106107
count -= 1;
107108
};
108-
return {status: status, out: outs, err: errs};
109+
return Result {status: status, out: outs, err: errs};
109110
}
110111

111112
fn writeclose(fd: c_int, s: Option<~str>) {

0 commit comments

Comments
 (0)