Skip to content

Commit 83ced67

Browse files
committed
librustdoc: De-export compiletest, combine-tests, libcargo, libfuzzer, and librustdoc. rs=deexporting
1 parent d73bf62 commit 83ced67

19 files changed

+213
-256
lines changed

src/compiletest/common.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ use core::prelude::*;
1212

1313
use cmp;
1414

15-
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }
16-
17-
impl mode : cmp::Eq {
18-
pure fn eq(&self, other: &mode) -> bool {
19-
(*other) as int == (*self) as int
20-
}
21-
pure fn ne(&self, other: &mode) -> bool { !(*self).eq(other) }
15+
#[deriving_eq]
16+
pub enum mode {
17+
mode_compile_fail,
18+
mode_run_fail,
19+
mode_run_pass,
20+
mode_pretty,
2221
}
2322

24-
type config = {
23+
pub type config = {
2524
// The library paths required for running the compiler
2625
compile_lib_path: ~str,
2726

src/compiletest/compiletest.rc

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#[crate_type = "bin"];
1212

1313
#[no_core];
14-
#[legacy_exports];
1514
#[legacy_records];
1615

1716
#[allow(vecs_implicitly_copyable)];
@@ -24,17 +23,11 @@ extern mod std(vers = "0.6");
2423

2524
use core::*;
2625

27-
#[legacy_exports]
2826
mod procsrv;
29-
#[legacy_exports]
3027
mod util;
31-
#[legacy_exports]
3228
mod header;
33-
#[legacy_exports]
3429
mod runtest;
35-
#[legacy_exports]
3630
mod common;
37-
#[legacy_exports]
3831
mod errors;
3932

4033
use std::getopts;
@@ -51,14 +44,14 @@ use common::mode_pretty;
5144
use common::mode;
5245
use util::logv;
5346

54-
fn main() {
47+
pub fn main() {
5548
let args = os::args();
5649
let config = parse_config(args);
5750
log_config(config);
5851
run_tests(config);
5952
}
6053

61-
fn parse_config(args: ~[~str]) -> config {
54+
pub fn parse_config(args: ~[~str]) -> config {
6255
let opts =
6356
~[getopts::reqopt(~"compile-lib-path"),
6457
getopts::reqopt(~"run-lib-path"),
@@ -105,7 +98,7 @@ fn parse_config(args: ~[~str]) -> config {
10598
verbose: getopts::opt_present(matches, ~"verbose")};
10699
}
107100

108-
fn log_config(config: config) {
101+
pub fn log_config(config: config) {
109102
let c = config;
110103
logv(c, fmt!("configuration:"));
111104
logv(c, fmt!("compile_lib_path: %s", config.compile_lib_path));
@@ -124,15 +117,15 @@ fn log_config(config: config) {
124117
logv(c, fmt!("\n"));
125118
}
126119

127-
fn opt_str(maybestr: Option<~str>) -> ~str {
120+
pub fn opt_str(maybestr: Option<~str>) -> ~str {
128121
match maybestr { option::Some(s) => s, option::None => ~"(none)" }
129122
}
130123

131-
fn str_opt(maybestr: ~str) -> Option<~str> {
124+
pub fn str_opt(maybestr: ~str) -> Option<~str> {
132125
if maybestr != ~"(none)" { option::Some(maybestr) } else { option::None }
133126
}
134127

135-
fn str_mode(s: ~str) -> mode {
128+
pub fn str_mode(s: ~str) -> mode {
136129
match s {
137130
~"compile-fail" => mode_compile_fail,
138131
~"run-fail" => mode_run_fail,
@@ -142,7 +135,7 @@ fn str_mode(s: ~str) -> mode {
142135
}
143136
}
144137

145-
fn mode_str(mode: mode) -> ~str {
138+
pub fn mode_str(mode: mode) -> ~str {
146139
match mode {
147140
mode_compile_fail => ~"compile-fail",
148141
mode_run_fail => ~"run-fail",
@@ -151,22 +144,22 @@ fn mode_str(mode: mode) -> ~str {
151144
}
152145
}
153146

154-
fn run_tests(config: config) {
147+
pub fn run_tests(config: config) {
155148
let opts = test_opts(config);
156149
let tests = make_tests(config);
157150
let res = test::run_tests_console(&opts, tests);
158151
if !res { fail ~"Some tests failed"; }
159152
}
160153

161-
fn test_opts(config: config) -> test::TestOpts {
154+
pub fn test_opts(config: config) -> test::TestOpts {
162155
test::TestOpts {
163156
filter: config.filter,
164157
run_ignored: config.run_ignored,
165158
logfile: config.logfile.map(|s| s.to_str()),
166159
}
167160
}
168161

169-
fn make_tests(config: config) -> ~[test::TestDesc] {
162+
pub fn make_tests(config: config) -> ~[test::TestDesc] {
170163
debug!("making tests from %s",
171164
config.src_base.to_str());
172165
let mut tests = ~[];
@@ -180,7 +173,7 @@ fn make_tests(config: config) -> ~[test::TestDesc] {
180173
move tests
181174
}
182175

183-
fn is_test(config: config, testfile: &Path) -> bool {
176+
pub fn is_test(config: config, testfile: &Path) -> bool {
184177
// Pretty-printer does not work with .rc files yet
185178
let valid_extensions =
186179
match config.mode {
@@ -203,7 +196,7 @@ fn is_test(config: config, testfile: &Path) -> bool {
203196
return valid;
204197
}
205198

206-
fn make_test(config: config, testfile: &Path) ->
199+
pub fn make_test(config: config, testfile: &Path) ->
207200
test::TestDesc {
208201
test::TestDesc {
209202
name: make_test_name(config, testfile),
@@ -213,11 +206,11 @@ fn make_test(config: config, testfile: &Path) ->
213206
}
214207
}
215208

216-
fn make_test_name(config: config, testfile: &Path) -> ~str {
209+
pub fn make_test_name(config: config, testfile: &Path) -> ~str {
217210
fmt!("[%s] %s", mode_str(config.mode), testfile.to_str())
218211
}
219212

220-
fn make_test_closure(config: config, testfile: &Path) -> test::TestFn {
213+
pub fn make_test_closure(config: config, testfile: &Path) -> test::TestFn {
221214
let testfile = testfile.to_str();
222215
fn~() { runtest::run(config, testfile) }
223216
}

src/compiletest/errors.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ use io;
1515
use io::ReaderUtil;
1616
use str;
1717

18-
export load_errors;
19-
export ExpectedError;
20-
21-
struct ExpectedError { line: uint, kind: ~str, msg: ~str }
18+
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
2219

2320
// Load any test directives embedded in the file
24-
fn load_errors(testfile: &Path) -> ~[ExpectedError] {
21+
pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
2522
let mut error_patterns = ~[];
2623
let rdr = io::file_reader(testfile).get();
2724
let mut line_num = 1u;

src/compiletest/header.rs

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

20-
export TestProps;
21-
export load_props;
22-
export is_test_ignored;
23-
24-
struct TestProps {
20+
pub struct TestProps {
2521
// Lines that should be expected, in order, on standard out
2622
error_patterns: ~[~str],
2723
// Extra flags to pass to the compiler
@@ -36,7 +32,7 @@ struct TestProps {
3632
}
3733

3834
// Load any test directives embedded in the file
39-
fn load_props(testfile: &Path) -> TestProps {
35+
pub fn load_props(testfile: &Path) -> TestProps {
4036
let mut error_patterns = ~[];
4137
let mut aux_builds = ~[];
4238
let mut exec_env = ~[];
@@ -73,7 +69,7 @@ fn load_props(testfile: &Path) -> TestProps {
7369
};
7470
}
7571

76-
fn is_test_ignored(config: config, testfile: &Path) -> bool {
72+
pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
7773
let mut found = false;
7874
for iter_header(testfile) |ln| {
7975
if parse_name_directive(ln, ~"xfail-test") { return true; }

src/compiletest/procsrv.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use str;
2222
use task;
2323
use vec;
2424

25-
export run;
26-
2725
#[cfg(target_os = "win32")]
2826
fn target_env(lib_path: ~str, prog: ~str) -> ~[(~str,~str)] {
2927

@@ -54,12 +52,11 @@ fn target_env(_lib_path: ~str, _prog: ~str) -> ~[(~str,~str)] {
5452
struct Result {status: int, out: ~str, err: ~str}
5553

5654
// FIXME (#2659): This code is duplicated in core::run::program_output
57-
fn run(lib_path: ~str,
58-
prog: ~str,
59-
args: ~[~str],
60-
env: ~[(~str, ~str)],
61-
input: Option<~str>) -> Result {
62-
55+
pub fn run(lib_path: ~str,
56+
prog: ~str,
57+
args: ~[~str],
58+
env: ~[(~str, ~str)],
59+
input: Option<~str>) -> Result {
6360
let pipe_in = os::pipe();
6461
let pipe_out = os::pipe();
6562
let pipe_err = os::pipe();

src/compiletest/runtest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ use procsrv;
3131
use util;
3232
use util::logv;
3333

34-
export run;
35-
36-
fn run(config: config, testfile: ~str) {
34+
pub fn run(config: config, testfile: ~str) {
3735
if config.verbose {
3836
// We're going to be dumping a lot of info. Start on a new line.
3937
io::stdout().write_str(~"\n\n");

src/compiletest/util.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use os::getenv;
1717
use common;
1818
use common::config;
1919

20-
fn make_new_path(path: ~str) -> ~str {
20+
pub fn make_new_path(path: ~str) -> ~str {
2121

2222
// Windows just uses PATH as the library search path, so we have to
2323
// maintain the current value while adding our own
@@ -31,23 +31,23 @@ fn make_new_path(path: ~str) -> ~str {
3131

3232
#[cfg(target_os = "linux")]
3333
#[cfg(target_os = "freebsd")]
34-
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
34+
pub fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
3535

3636
#[cfg(target_os = "macos")]
37-
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
37+
pub fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
3838

3939
#[cfg(target_os = "win32")]
40-
fn lib_path_env_var() -> ~str { ~"PATH" }
40+
pub fn lib_path_env_var() -> ~str { ~"PATH" }
4141

4242
#[cfg(target_os = "linux")]
4343
#[cfg(target_os = "macos")]
4444
#[cfg(target_os = "freebsd")]
45-
fn path_div() -> ~str { ~":" }
45+
pub fn path_div() -> ~str { ~":" }
4646

4747
#[cfg(target_os = "win32")]
48-
fn path_div() -> ~str { ~";" }
48+
pub fn path_div() -> ~str { ~";" }
4949

50-
fn logv(config: config, s: ~str) {
50+
pub fn logv(config: config, s: ~str) {
5151
log(debug, s);
5252
if config.verbose { io::println(s); }
5353
}

src/etc/combine-tests.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ def scrub(b):
3737
c = open("tmp/run_pass_stage2.rc", "w")
3838
i = 0
3939
c.write("// AUTO-GENERATED FILE: DO NOT EDIT\n")
40-
c.write("#[legacy_exports];\n")
4140
c.write("#[link(name=\"run_pass_stage2\", vers=\"0.1\")];\n")
4241
for t in stage2_tests:
4342
p = os.path.join(run_pass, t)
4443
p = p.replace("\\", "\\\\")
4544
c.write("#[path = \"%s\"]" % p);
46-
c.write("#[legacy_exports]");
47-
c.write("mod t_%d;\n" % i)
45+
c.write("pub mod t_%d;\n" % i)
4846
i += 1
4947
c.close()
5048

0 commit comments

Comments
 (0)