Skip to content

Commit 0a4d0f3

Browse files
committed
librustc: Enforce that extern mod directives come first, then use directives, then items.
Resolve them in this order as well.
1 parent 8b56a83 commit 0a4d0f3

File tree

14 files changed

+330
-333
lines changed

14 files changed

+330
-333
lines changed

src/compiletest/compiletest.rc

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ extern mod std(vers = "0.6");
2222

2323
use core::*;
2424

25-
pub mod procsrv;
26-
pub mod util;
27-
pub mod header;
28-
pub mod runtest;
29-
pub mod common;
30-
pub mod errors;
3125

3226
use std::getopts;
3327
use std::test;
@@ -43,6 +37,13 @@ use common::mode_debug_info;
4337
use common::mode;
4438
use util::logv;
4539

40+
pub mod procsrv;
41+
pub mod util;
42+
pub mod header;
43+
pub mod runtest;
44+
pub mod common;
45+
pub mod errors;
46+
4647
pub fn main() {
4748
let args = os::args();
4849
let config = parse_config(args);

src/libcore/core.rc

+40-40
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,45 @@ they contained the following prologue:
6565
#[allow(deprecated_mutable_fields)];
6666
#[allow(deprecated_drop)];
6767

68+
// Make core testable by not duplicating lang items. See #2912
69+
#[cfg(test)] extern mod realcore(name = "core", vers = "0.6");
70+
#[cfg(test)] pub use kinds = realcore::kinds;
71+
#[cfg(test)] pub use ops = realcore::ops;
72+
#[cfg(test)] pub use cmp = realcore::cmp;
73+
74+
/* Reexported core operators */
75+
76+
pub use kinds::{Const, Copy, Owned, Durable};
77+
pub use ops::{Drop};
78+
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
79+
pub use ops::{BitAnd, BitOr, BitXor};
80+
pub use ops::{Shl, Shr, Index};
81+
82+
83+
/* Reexported types and traits */
84+
85+
pub use option::{Option, Some, None};
86+
pub use result::{Result, Ok, Err};
87+
88+
pub use path::Path;
89+
pub use path::GenericPath;
90+
pub use path::WindowsPath;
91+
pub use path::PosixPath;
92+
93+
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
94+
pub use str::{StrSlice};
95+
pub use container::{Container, Mutable};
96+
pub use vec::{CopyableVector, ImmutableVector};
97+
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
98+
pub use vec::{OwnedVector, OwnedCopyableVector};
99+
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
100+
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
101+
102+
pub use num::NumCast;
103+
pub use ptr::Ptr;
104+
pub use to_str::ToStr;
105+
pub use clone::Clone;
106+
68107
// On Linux, link to the runtime with -lrt.
69108
#[cfg(target_os = "linux")]
70109
#[doc(hidden)]
@@ -130,12 +169,6 @@ pub mod managed;
130169
#[cfg(notest)] pub mod ops;
131170
#[cfg(notest)] pub mod cmp;
132171

133-
// Make core testable by not duplicating lang items. See #2912
134-
#[cfg(test)] extern mod realcore(name = "core", vers = "0.6");
135-
#[cfg(test)] pub use kinds = realcore::kinds;
136-
#[cfg(test)] pub use ops = realcore::ops;
137-
#[cfg(test)] pub use cmp = realcore::cmp;
138-
139172

140173
/* Common traits */
141174

@@ -189,39 +222,6 @@ pub mod condition;
189222
pub mod logging;
190223
pub mod util;
191224

192-
/* Reexported core operators */
193-
194-
pub use kinds::{Const, Copy, Owned, Durable};
195-
pub use ops::{Drop};
196-
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
197-
pub use ops::{BitAnd, BitOr, BitXor};
198-
pub use ops::{Shl, Shr, Index};
199-
200-
201-
/* Reexported types and traits */
202-
203-
pub use option::{Option, Some, None};
204-
pub use result::{Result, Ok, Err};
205-
206-
pub use path::Path;
207-
pub use path::GenericPath;
208-
pub use path::WindowsPath;
209-
pub use path::PosixPath;
210-
211-
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
212-
pub use str::{StrSlice};
213-
pub use container::{Container, Mutable};
214-
pub use vec::{CopyableVector, ImmutableVector};
215-
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
216-
pub use vec::{OwnedVector, OwnedCopyableVector};
217-
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
218-
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
219-
220-
pub use num::NumCast;
221-
pub use ptr::Ptr;
222-
pub use to_str::ToStr;
223-
pub use clone::Clone;
224-
225225

226226
/* Unsupported interfaces */
227227

@@ -241,7 +241,7 @@ pub mod rt;
241241
// 'core' so that macro-expanded references to core::error and such
242242
// can be resolved within libcore.
243243
#[doc(hidden)]
244-
pub mod core {
244+
mod core {
245245
pub use clone;
246246
pub use cmp;
247247
pub use condition;

src/libcore/managed.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ use ptr;
1515
#[cfg(notest)] use cmp::{Eq, Ord};
1616

1717
pub mod raw {
18+
use intrinsic::TyDesc;
1819

1920
pub static RC_EXCHANGE_UNIQUE : uint = (-1) as uint;
2021
pub static RC_MANAGED_UNIQUE : uint = (-2) as uint;
2122
pub static RC_IMMORTAL : uint = 0x77777777;
2223

23-
use intrinsic::TyDesc;
24-
2524
pub struct BoxHeaderRepr {
2625
ref_count: uint,
2726
type_desc: *TyDesc,

src/libcore/os.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,6 @@ pub mod consts {
11671167
#[cfg(windows)]
11681168
pub use os::consts::windows::*;
11691169
1170-
pub mod unix {
1171-
pub static FAMILY: &'static str = "unix";
1172-
}
1173-
1174-
pub mod windows {
1175-
pub static FAMILY: &'static str = "windows";
1176-
}
1177-
11781170
#[cfg(target_os = "macos")]
11791171
pub use os::consts::macos::*;
11801172
@@ -1190,6 +1182,26 @@ pub mod consts {
11901182
#[cfg(target_os = "win32")]
11911183
pub use os::consts::win32::*;
11921184
1185+
#[cfg(target_arch = "x86")]
1186+
pub use os::consts::x86::*;
1187+
1188+
#[cfg(target_arch = "x86_64")]
1189+
pub use os::consts::x86_64::*;
1190+
1191+
#[cfg(target_arch = "arm")]
1192+
pub use os::consts::arm::*;
1193+
1194+
#[cfg(target_arch = "mips")]
1195+
use os::consts::mips::*;
1196+
1197+
pub mod unix {
1198+
pub static FAMILY: &'static str = "unix";
1199+
}
1200+
1201+
pub mod windows {
1202+
pub static FAMILY: &'static str = "windows";
1203+
}
1204+
11931205
pub mod macos {
11941206
pub static SYSNAME: &'static str = "macos";
11951207
pub static DLL_PREFIX: &'static str = "lib";
@@ -1226,18 +1238,6 @@ pub mod consts {
12261238
}
12271239
12281240
1229-
#[cfg(target_arch = "x86")]
1230-
pub use os::consts::x86::*;
1231-
1232-
#[cfg(target_arch = "x86_64")]
1233-
pub use os::consts::x86_64::*;
1234-
1235-
#[cfg(target_arch = "arm")]
1236-
pub use os::consts::arm::*;
1237-
1238-
#[cfg(target_arch = "mips")]
1239-
use os::consts::mips::*;
1240-
12411241
pub mod x86 {
12421242
pub static ARCH: &'static str = "x86";
12431243
}

0 commit comments

Comments
 (0)