Skip to content

Commit 4c2e4c3

Browse files
committed
librustc: Make use statements crate-relative by default. r=brson
1 parent 3c8dca4 commit 4c2e4c3

File tree

226 files changed

+1315
-1131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+1315
-1131
lines changed

src/libcargo/cargo.rc

+14-15
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,25 @@ extern mod std(vers = "0.5");
4242
extern mod rustc(vers = "0.5");
4343
extern mod syntax(vers = "0.5");
4444

45-
use core::*;
46-
4745
#[legacy_exports]
4846
mod pgp;
4947

50-
use syntax::{ast, codemap, parse, visit, attr};
51-
use syntax::diagnostic::span_handler;
52-
use codemap::span;
53-
use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest,
54-
get_cargo_sysroot, libdir};
55-
use syntax::diagnostic;
48+
use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest};
49+
use rustc::metadata::filesearch::{get_cargo_sysroot, libdir};
5650

57-
use result::{Ok, Err};
58-
use io::WriterUtil;
59-
use send_map::linear::LinearMap;
51+
use core::*;
52+
53+
use core::dvec::DVec;
54+
use core::io::WriterUtil;
55+
use core::result::{Ok, Err};
56+
use core::send_map::linear::LinearMap;
57+
use std::getopts::{optflag, optopt, opt_present};
58+
use std::map::HashMap;
6059
use std::{map, json, tempfile, term, sort, getopts};
61-
use map::HashMap;
62-
use to_str::to_str;
63-
use getopts::{optflag, optopt, opt_present};
64-
use dvec::DVec;
60+
use syntax::codemap::span;
61+
use syntax::diagnostic::span_handler;
62+
use syntax::diagnostic;
63+
use syntax::{ast, codemap, parse, visit, attr};
6564

6665
struct Package {
6766
name: ~str,

src/libcore/core.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ mod core {
247247
#[cfg(test)]
248248
mod std {
249249
extern mod std(vers = "0.5");
250-
pub use std::test;
250+
pub use std::std::test;
251251
}
252252

253253

src/libcore/int-template.rs

+5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
#[forbid(deprecated_mode)];
1313
#[forbid(deprecated_pattern)];
1414

15+
#[cfg(stage0)]
1516
use T = inst::T;
17+
#[cfg(stage1)]
18+
#[cfg(stage2)]
19+
use T = self::inst::T;
20+
1621
use cmp::{Eq, Ord};
1722
use from_str::FromStr;
1823
use num::from_int;

src/libcore/int-template/int.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
//! Operations and constants for `int`
1212
13+
#[cfg(stage0)]
1314
pub use inst::pow;
15+
#[cfg(stage1)]
16+
#[cfg(stage2)]
17+
pub use self::inst::pow;
1418

1519
mod inst {
1620
pub type T = int;
@@ -54,4 +58,4 @@ mod inst {
5458
assert (min_value <= 0);
5559
assert (min_value + max_value + 1 == 0);
5660
}
57-
}
61+
}

src/libcore/iter-trait.rs

+5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
#[forbid(deprecated_pattern)];
1717

1818
use cmp::{Eq, Ord};
19+
20+
#[cfg(stage0)]
1921
use inst::{IMPL_T, EACH, SIZE_HINT};
22+
#[cfg(stage1)]
23+
#[cfg(stage2)]
24+
use self::inst::{IMPL_T, EACH, SIZE_HINT};
2025

2126
impl<A> IMPL_T<A>: iter::BaseIter<A> {
2227
pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) }

src/libcore/libc.rs

+99-83
Original file line numberDiff line numberDiff line change
@@ -59,89 +59,109 @@
5959
// Initial glob-exports mean that all the contents of all the modules
6060
// wind up exported, if you're interested in writing platform-specific code.
6161

62-
pub use types::common::c95::*;
63-
pub use types::common::c99::*;
64-
pub use types::common::posix88::*;
65-
pub use types::common::posix01::*;
66-
pub use types::common::posix08::*;
67-
pub use types::common::bsd44::*;
68-
pub use types::os::common::posix01::*;
69-
pub use types::os::arch::c95::*;
70-
pub use types::os::arch::c99::*;
71-
pub use types::os::arch::posix88::*;
72-
pub use types::os::arch::posix01::*;
73-
pub use types::os::arch::posix08::*;
74-
pub use types::os::arch::bsd44::*;
75-
pub use types::os::arch::extra::*;
76-
77-
pub use consts::os::c95::*;
78-
pub use consts::os::c99::*;
79-
pub use consts::os::posix88::*;
80-
pub use consts::os::posix01::*;
81-
pub use consts::os::posix08::*;
82-
pub use consts::os::bsd44::*;
83-
pub use consts::os::extra::*;
84-
85-
pub use funcs::c95::ctype::*;
86-
pub use funcs::c95::stdio::*;
87-
pub use funcs::c95::stdlib::*;
88-
pub use funcs::c95::string::*;
89-
90-
pub use funcs::posix88::stat_::*;
91-
pub use funcs::posix88::stdio::*;
92-
pub use funcs::posix88::fcntl::*;
93-
pub use funcs::posix88::dirent::*;
94-
pub use funcs::posix88::unistd::*;
95-
96-
pub use funcs::posix01::stat_::*;
97-
pub use funcs::posix01::unistd::*;
98-
pub use funcs::posix08::unistd::*;
99-
100-
pub use funcs::bsd44::*;
101-
pub use funcs::extra::*;
62+
pub use libc::types::common::c95::*;
63+
pub use libc::types::common::c99::*;
64+
pub use libc::types::common::posix88::*;
65+
pub use libc::types::common::posix01::*;
66+
pub use libc::types::common::posix08::*;
67+
pub use libc::types::common::bsd44::*;
68+
pub use libc::types::os::common::posix01::*;
69+
pub use libc::types::os::arch::c95::*;
70+
pub use libc::types::os::arch::c99::*;
71+
pub use libc::types::os::arch::posix88::*;
72+
pub use libc::types::os::arch::posix01::*;
73+
pub use libc::types::os::arch::posix08::*;
74+
pub use libc::types::os::arch::bsd44::*;
75+
pub use libc::types::os::arch::extra::*;
76+
77+
pub use libc::consts::os::c95::*;
78+
pub use libc::consts::os::c99::*;
79+
pub use libc::consts::os::posix88::*;
80+
pub use libc::consts::os::posix01::*;
81+
pub use libc::consts::os::posix08::*;
82+
pub use libc::consts::os::bsd44::*;
83+
pub use libc::consts::os::extra::*;
84+
85+
pub use libc::funcs::c95::ctype::*;
86+
pub use libc::funcs::c95::stdio::*;
87+
pub use libc::funcs::c95::stdlib::*;
88+
pub use libc::funcs::c95::string::*;
89+
90+
pub use libc::funcs::posix88::stat_::*;
91+
pub use libc::funcs::posix88::stdio::*;
92+
pub use libc::funcs::posix88::fcntl::*;
93+
pub use libc::funcs::posix88::dirent::*;
94+
pub use libc::funcs::posix88::unistd::*;
95+
96+
pub use libc::funcs::posix01::stat_::*;
97+
pub use libc::funcs::posix01::unistd::*;
98+
pub use libc::funcs::posix08::unistd::*;
99+
100+
pub use libc::funcs::bsd44::*;
101+
pub use libc::funcs::extra::*;
102+
103+
#[cfg(target_os = "win32")]
104+
pub use libc::funcs::extra::kernel32::*;
105+
#[cfg(target_os = "win32")]
106+
pub use libc::funcs::extra::msvcrt::*;
102107

103108
// Explicit export lists for the intersection (provided here) mean that
104109
// you can write more-platform-agnostic code if you stick to just these
105110
// symbols.
106111

107-
pub use size_t;
108-
pub use c_float, c_double, c_void, FILE, fpos_t;
109-
pub use DIR, dirent_t;
110-
pub use c_char, c_schar, c_uchar;
111-
pub use c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
112-
pub use size_t, ptrdiff_t, clock_t, time_t;
113-
pub use c_longlong, c_ulonglong, intptr_t, uintptr_t;
114-
pub use off_t, dev_t, ino_t, pid_t, mode_t, ssize_t;
115-
116-
pub use EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX,
117-
EOF, SEEK_SET, SEEK_CUR, SEEK_END, _IOFBF, _IONBF, _IOLBF,
118-
BUFSIZ, FOPEN_MAX, FILENAME_MAX, L_tmpnam, TMP_MAX,
119-
O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_EXCL, O_TRUNC,
120-
S_IFIFO, S_IFCHR, S_IFBLK, S_IFDIR, S_IFREG, S_IFMT, S_IEXEC,
121-
S_IWRITE, S_IREAD, S_IRWXU, S_IXUSR, S_IWUSR, S_IRUSR, F_OK, R_OK,
122-
W_OK, X_OK, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO;
123-
124-
pub use isalnum, isalpha, iscntrl, isdigit, islower, isprint, ispunct,
125-
isspace, isupper, isxdigit, tolower, toupper;
126-
127-
pub use fopen, freopen, fflush, fclose, remove, tmpfile, setvbuf, setbuf,
128-
fgetc, fgets, fputc, fputs, puts, ungetc, fread, fwrite, fseek, ftell,
129-
rewind, fgetpos, fsetpos, feof, ferror, perror;
130-
131-
pub use abs, labs, atof, atoi, strtod, strtol, strtoul, calloc, malloc,
132-
realloc, free, abort, exit, system, getenv, rand, srand;
133-
134-
pub use strcpy, strncpy, strcat, strncat, strcmp, strncmp, strcoll, strchr,
135-
strrchr, strspn, strcspn, strpbrk, strstr, strlen, strerror, strtok,
136-
strxfrm, memcpy, memmove, memcmp, memchr, memset;
137-
138-
pub use chmod, mkdir;
139-
pub use popen, pclose, fdopen, fileno;
140-
pub use open, creat;
141-
pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
142-
getpid, isatty, lseek, pipe, read, rmdir, unlink, write;
143-
144-
pub use fstat, stat;
112+
pub use libc::types::common::c95::{FILE, c_void, fpos_t};
113+
pub use libc::types::common::posix88::{DIR, dirent_t};
114+
pub use libc::types::os::arch::c95::{c_char, c_double, c_float, c_int};
115+
pub use libc::types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong};
116+
pub use libc::types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
117+
pub use libc::types::os::arch::c95::{size_t, time_t};
118+
pub use libc::types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
119+
pub use libc::types::os::arch::c99::{uintptr_t};
120+
pub use libc::types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
121+
pub use libc::types::os::arch::posix88::{off_t, pid_t, ssize_t};
122+
123+
pub use libc::consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
124+
pub use libc::consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
125+
pub use libc::consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
126+
pub use libc::consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
127+
pub use libc::consts::os::c95::{SEEK_SET, TMP_MAX};
128+
pub use libc::consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
129+
pub use libc::consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
130+
pub use libc::consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
131+
pub use libc::consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG};
132+
pub use libc::consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
133+
pub use libc::consts::os::posix88::{STDERR_FILENO, STDIN_FILENO};
134+
pub use libc::consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
135+
136+
pub use libc::funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
137+
pub use libc::funcs::c95::ctype::{islower, isprint, ispunct, isspace};
138+
pub use libc::funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
139+
140+
pub use libc::funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
141+
pub use libc::funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
142+
pub use libc::funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
143+
pub use libc::funcs::c95::stdio::{fwrite, perror, puts, remove, rewind};
144+
pub use libc::funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
145+
146+
pub use libc::funcs::c95::stdlib::{abort, abs, atof, atoi, calloc, exit};
147+
pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
148+
pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol};
149+
pub use libc::funcs::c95::stdlib::{strtoul, system};
150+
151+
pub use libc::funcs::c95::string::{memchr, memcmp, memcpy, memmove};
152+
pub use libc::funcs::c95::string::{memset, strcat, strchr, strcmp};
153+
pub use libc::funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
154+
pub use libc::funcs::c95::string::{strlen, strncat, strncmp, strncpy};
155+
pub use libc::funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
156+
pub use libc::funcs::c95::string::{strtok, strxfrm};
157+
158+
pub use libc::funcs::posix88::fcntl::{open, creat};
159+
pub use libc::funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
160+
pub use libc::funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
161+
pub use libc::funcs::posix88::unistd::{access, chdir, close, dup, dup2};
162+
pub use libc::funcs::posix88::unistd::{execv, execve, execvp, getcwd};
163+
pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
164+
pub use libc::funcs::posix88::unistd::{rmdir, unlink, write};
145165

146166

147167
mod types {
@@ -1365,10 +1385,6 @@ pub mod funcs {
13651385

13661386
#[cfg(target_os = "win32")]
13671387
pub mod extra {
1368-
use types::os::arch::extra::*;
1369-
pub use kernel32::*;
1370-
pub use msvcrt::*;
1371-
13721388
#[abi = "stdcall"]
13731389
pub extern mod kernel32 {
13741390
fn GetEnvironmentVariableW(n: LPCWSTR,
@@ -1396,7 +1412,7 @@ pub mod funcs {
13961412
#[nolink]
13971413
pub extern mod msvcrt {
13981414
#[link_name = "_commit"]
1399-
fn commit(fd: c_int) -> c_int;
1415+
pub fn commit(fd: c_int) -> c_int;
14001416
}
14011417
}
14021418
}

0 commit comments

Comments
 (0)