Install new pub/priv/export rules as defaults, old rules accessible under #[legacy_exports];

This commit is contained in:
Graydon Hoare 2012-09-21 18:10:45 -07:00
parent 60443d4888
commit dffe188991
277 changed files with 1174 additions and 120 deletions

View File

@ -875,7 +875,8 @@ declaration replaces the default export with the export specified.
An example of an export:
~~~~~~~~
mod foo {
pub mod foo {
#[legacy_exports];
export primary;
fn primary() {

View File

@ -123,7 +123,9 @@ null pointers.
The `sha1` function is the most obscure part of the program.
~~~~
# mod crypto { fn SHA1(src: *u8, sz: uint, out: *u8) -> *u8 { out } }
# pub mod crypto {
# pub fn SHA1(src: *u8, sz: uint, out: *u8) -> *u8 { out }
# }
# fn as_hex(data: ~[u8]) -> ~str { ~"hi" }
fn sha1(data: ~str) -> ~str {
unsafe {
@ -166,7 +168,9 @@ Rust's safety mechanisms.
Let's look at our `sha1` function again.
~~~~
# mod crypto { fn SHA1(src: *u8, sz: uint, out: *u8) -> *u8 { out } }
# pub mod crypto {
# pub fn SHA1(src: *u8, sz: uint, out: *u8) -> *u8 { out }
# }
# fn as_hex(data: ~[u8]) -> ~str { ~"hi" }
# fn x(data: ~str) -> ~str {
# unsafe {

View File

@ -1820,6 +1820,7 @@ explicitly import it, you must refer to it by its long name,
`farm::chicken`.
~~~~
#[legacy_exports]
mod farm {
fn chicken() -> ~str { ~"cluck cluck" }
fn cow() -> ~str { ~"mooo" }
@ -2004,6 +2005,7 @@ Rust uses three different namespaces: one for modules, one for types,
and one for values. This means that this code is valid:
~~~~
#[legacy_exports]
mod buffalo {
type buffalo = int;
fn buffalo<buffalo>(+buffalo: buffalo) -> buffalo { buffalo }

View File

@ -17,6 +17,7 @@
#[crate_type = "bin"];
#[no_core];
#[legacy_exports];
#[allow(vecs_implicitly_copyable,
non_implicitly_copyable_typarams)];
@ -29,4 +30,5 @@ extern mod syntax(vers = "0.4");
use core::*;
#[legacy_exports]
mod pgp;

View File

@ -1,5 +1,7 @@
// cargo.rs - Rust package manager
#[legacy_exports];
use syntax::{ast, codemap, parse, visit, attr};
use syntax::diagnostic::span_handler;
use codemap::span;

View File

@ -1,6 +1,7 @@
#[crate_type = "bin"];
#[no_core];
#[legacy_exports];
#[allow(vecs_implicitly_copyable)];
#[allow(non_camel_case_types)];
@ -10,11 +11,17 @@ extern mod std(vers = "0.4");
use core::*;
#[legacy_exports]
mod procsrv;
#[legacy_exports]
mod util;
#[legacy_exports]
mod header;
#[legacy_exports]
mod runtest;
#[legacy_exports]
mod common;
#[legacy_exports]
mod errors;
// Local Variables:

View File

@ -5,6 +5,7 @@
#[no_core];
#[legacy_modes];
#[legacy_exports];
#[allow(vecs_implicitly_copyable)];
#[allow(non_camel_case_types)];

View File

@ -1,3 +1,5 @@
#[legacy_exports];
use io::WriterUtil;
use syntax::{ast, ast_util, fold, visit, codemap};

View File

@ -15,6 +15,7 @@ export traits;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
++v: **vec::raw::VecRepr,
++n: libc::size_t);
@ -22,6 +23,7 @@ extern mod rustrt {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn move_val_init<T>(&dst: T, -src: T);
}
@ -135,6 +137,7 @@ pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
#[cfg(notest)]
mod traits {
#[legacy_exports];
#[cfg(stage0)]
impl<T: Copy> @[T]: Add<&[const T],@[T]> {
#[inline(always)]
@ -153,9 +156,11 @@ mod traits {
}
#[cfg(test)]
mod traits {}
mod traits {
#[legacy_exports];}
mod raw {
#[legacy_exports];
type VecRepr = vec::raw::VecRepr;
type SliceRepr = vec::raw::SliceRepr;

View File

@ -10,6 +10,7 @@ use intrinsic::TyDesc;
export ptr_eq, raw;
mod raw {
#[legacy_exports];
struct BoxHeaderRepr {
ref_count: uint,

View File

@ -8,6 +8,7 @@ export copy_lifetime, copy_lifetime_vec;
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn forget<T>(-x: T);
fn reinterpret_cast<T, U>(e: T) -> U;
}
@ -97,6 +98,7 @@ unsafe fn copy_lifetime_vec<S,T>(_ptr: &a/[S], ptr: &T) -> &a/T {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_reinterpret_cast() {

View File

@ -121,6 +121,7 @@ pub unsafe fn annihilate() {
/// Bindings to the runtime
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
/*priv*/ fn rust_get_task() -> *c_void;
}

View File

@ -23,6 +23,7 @@ use libc::c_double;
#[link_name = "m"]
#[abi = "cdecl"]
extern mod c_double {
#[legacy_exports];
// Alpabetically sorted by link_name
@ -98,6 +99,7 @@ extern mod c_double {
#[link_name = "m"]
#[abi = "cdecl"]
extern mod c_float {
#[legacy_exports];
// Alpabetically sorted by link_name
@ -166,6 +168,7 @@ extern mod c_float {
// FIXME obtain machine float/math constants automatically (Issue #1986)
mod c_float_targ_consts {
#[legacy_exports];
const radix: uint = 2u;
const mantissa_digits: uint = 24u;
const digits: uint = 6u;
@ -181,6 +184,7 @@ mod c_float_targ_consts {
}
mod c_double_targ_consts {
#[legacy_exports];
const radix: uint = 2u;
const mantissa_digits: uint = 53u;
const digits: uint = 15u;
@ -200,6 +204,7 @@ mod c_double_targ_consts {
FIXME use these once they can be parsed (see Issue #1433)
mod c_float_math_consts {
#[legacy_exports];
const pi: c_float = 0x1.921fb6p+1_f32;
const div_1_pi: c_float = 0x1.45f306p-2_f32;
const div_2_pi: c_float = 0x1.45f306p-1_f32;
@ -216,6 +221,7 @@ mod c_float_math_consts {
}
mod c_double_math_consts {
#[legacy_exports];
const pi: c_double = 0x1.921fb54442d18p+1_f64;
const div_1_pi: c_double = 0x1.45f306dc9c883p-2_f64;
const div_2_pi: c_double = 0x1.45f306dc9c883p-1_f64;
@ -232,6 +238,7 @@ mod c_double_math_consts {
}
mod c_float_targ_consts {
#[legacy_exports];
const radix: uint = 2u;
const mantissa_digits: uint = 24u;
const digits: uint = 6u;
@ -245,6 +252,7 @@ mod c_float_targ_consts {
}
mod c_double_targ_consts {
#[legacy_exports];
const radix: uint = 2u;
const mantissa_digits: uint = 53u;
const digits: uint = 15u;

View File

@ -24,6 +24,7 @@ export Eq;
// Awful hack to work around duplicate lang items in core test.
#[cfg(notest)]
mod nounittest {
#[legacy_exports];
/**
* Trait for values that can be compared for a sort-order.
*
@ -75,10 +76,12 @@ mod nounittest {
}
#[cfg(test)]
mod nounittest {}
mod nounittest {
#[legacy_exports];}
#[cfg(test)]
mod unittest {
#[legacy_exports];
#[cfg(stage0)]
trait Ord {
pure fn lt(&&other: self) -> bool;
@ -111,7 +114,8 @@ mod unittest {
}
#[cfg(notest)]
mod unittest {}
mod unittest {
#[legacy_exports];}
#[cfg(stage0)]
pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {

View File

@ -275,6 +275,7 @@ type port_id = int;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn rust_port_id_send(target_port: port_id, data: *()) -> libc::uintptr_t;
fn new_port(unit_sz: libc::size_t) -> *rust_port;
@ -297,6 +298,7 @@ extern mod rustrt {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn init<T>() -> T;
}

View File

@ -85,43 +85,54 @@ export private;
/// Operations and constants for `int`
#[path = "int-template"]
mod int {
#[legacy_exports];
use inst::{ pow };
export pow;
#[path = "int.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `i8`
#[path = "int-template"]
mod i8 {
#[legacy_exports];
#[path = "i8.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `i16`
#[path = "int-template"]
mod i16 {
#[legacy_exports];
#[path = "i16.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `i32`
#[path = "int-template"]
mod i32 {
#[legacy_exports];
#[path = "i32.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `i64`
#[path = "int-template"]
mod i64 {
#[legacy_exports];
#[path = "i64.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `uint`
#[path = "uint-template"]
mod uint {
#[legacy_exports];
use inst::{
div_ceil, div_round, div_floor, iterate,
next_power_of_two
@ -130,135 +141,208 @@ mod uint {
next_power_of_two;
#[path = "uint.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u8`
#[path = "uint-template"]
mod u8 {
#[legacy_exports];
use inst::is_ascii;
export is_ascii;
#[path = "u8.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u16`
#[path = "uint-template"]
mod u16 {
#[legacy_exports];
#[path = "u16.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u32`
#[path = "uint-template"]
mod u32 {
#[legacy_exports];
#[path = "u32.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u64`
#[path = "uint-template"]
mod u64 {
#[legacy_exports];
#[path = "u64.rs"]
#[legacy_exports]
mod inst;
}
#[legacy_exports]
mod box;
#[legacy_exports]
mod char;
#[legacy_exports]
mod float;
#[legacy_exports]
mod f32;
#[legacy_exports]
mod f64;
#[legacy_exports]
mod str;
#[legacy_exports]
mod ptr;
#[legacy_exports]
mod vec;
#[legacy_exports]
mod at_vec;
#[legacy_exports]
mod bool;
#[legacy_exports]
mod tuple;
#[legacy_exports]
mod unit;
#[legacy_exports]
mod uniq;
// Ubiquitous-utility-type modules
#[cfg(notest)]
#[legacy_exports]
mod ops;
#[legacy_exports]
mod cmp;
#[legacy_exports]
mod num;
#[legacy_exports]
mod hash;
#[legacy_exports]
mod either;
#[legacy_exports]
mod iter;
#[legacy_exports]
mod logging;
#[legacy_exports]
mod option;
#[path="iter-trait"]
mod option_iter {
#[legacy_exports];
#[path = "option.rs"]
#[legacy_exports]
mod inst;
}
#[legacy_exports]
mod result;
#[legacy_exports]
mod to_str;
#[legacy_exports]
mod to_bytes;
#[legacy_exports]
mod from_str;
#[legacy_exports]
mod util;
// Data structure modules
#[legacy_exports]
mod dvec;
#[path="iter-trait"]
mod dvec_iter {
#[legacy_exports];
#[path = "dvec.rs"]
#[legacy_exports]
mod inst;
}
#[legacy_exports]
mod dlist;
#[path="iter-trait"]
mod dlist_iter {
#[legacy_exports];
#[path ="dlist.rs"]
#[legacy_exports]
mod inst;
}
#[legacy_exports]
mod send_map;
// Concurrency
#[legacy_exports]
mod comm;
#[legacy_exports]
mod task {
#[legacy_exports];
#[legacy_exports]
mod local_data;
#[legacy_exports]
mod local_data_priv;
#[legacy_exports]
mod spawn;
#[legacy_exports]
mod rt;
}
#[legacy_exports]
mod future;
#[legacy_exports]
mod pipes;
// Runtime and language-primitive support
#[legacy_exports]
mod gc;
#[legacy_exports]
mod io;
#[legacy_exports]
mod libc;
#[legacy_exports]
mod os;
#[legacy_exports]
mod path;
#[legacy_exports]
mod rand;
#[legacy_exports]
mod run;
#[legacy_exports]
mod sys;
#[legacy_exports]
mod cast;
#[legacy_exports]
mod mutable;
#[legacy_exports]
mod flate;
#[legacy_exports]
mod repr;
#[legacy_exports]
mod cleanup;
#[legacy_exports]
mod reflect;
// Modules supporting compiler-generated code
// Exported but not part of the public interface
#[legacy_exports]
mod extfmt;
// The test harness links against core, so don't include runtime in tests.
#[cfg(notest)]
#[legacy_exports]
mod rt;
// For internal use, not exported
#[legacy_exports]
mod unicode;
#[legacy_exports]
mod private;
#[legacy_exports]
mod cmath;
#[legacy_exports]
mod stackwalk;
// Local Variables:

View File

@ -2,6 +2,8 @@
// Export various ubiquitous types, constructors, methods.
#[legacy_exports];
use option::{Some, None};
use Option = option::Option;
use result::{Result, Ok, Err};
@ -84,6 +86,7 @@ const debug : u32 = 3_u32;
// can be resolved within libcore.
#[doc(hidden)] // FIXME #3538
mod core {
#[legacy_exports];
const error : u32 = 0_u32;
const warn : u32 = 1_u32;
const info : u32 = 2_u32;
@ -93,6 +96,7 @@ mod core {
// Similar to above. Some magic to make core testable.
#[cfg(test)]
mod std {
#[legacy_exports];
extern mod std(vers = "0.4");
use std::test;
}

View File

@ -452,6 +452,7 @@ impl<T: Copy> DList<T> {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_dlist_concat() {
let a = from_vec(~[1,2]);

View File

@ -42,6 +42,7 @@ use option::{Some, None};
// Functions used by the fmt extension at compile time
mod ct {
#[legacy_exports];
enum Signedness { Signed, Unsigned, }
enum Caseness { CaseUpper, CaseLower, }
enum Ty {
@ -273,6 +274,7 @@ mod ct {
// conditions can be evaluated at compile-time. For now though it's cleaner to
// implement it 0this way, I think.
mod rt {
#[legacy_exports];
const flag_none : u32 = 0u32;
const flag_left_justify : u32 = 0b00000000000000000000000000000001u32;
const flag_left_zero_pad : u32 = 0b00000000000000000000000000000010u32;
@ -479,6 +481,7 @@ mod rt {
// XXX remove after snapshots
mod rt2 {
#[legacy_exports];
const flag_none : u32 = 0u32;
const flag_left_justify : u32 = 0b00000000000000000000000000000001u32;
const flag_left_zero_pad : u32 = 0b00000000000000000000000000000010u32;
@ -685,6 +688,7 @@ mod rt2 {
#[cfg(test)]
mod test {
#[legacy_exports];
#[test]
fn fmt_slice() {
let s = "abc";

View File

@ -105,6 +105,7 @@ pure fn is_finite(x: f32) -> bool {
/* Module: consts */
mod consts {
#[legacy_exports];
// FIXME (requires Issue #1433 to fix): replace with mathematical
// constants from cmath.

View File

@ -132,6 +132,7 @@ pure fn is_finite(x: f64) -> bool {
/* Module: consts */
mod consts {
#[legacy_exports];
// FIXME (requires Issue #1433 to fix): replace with mathematical
// constants from cmath.

View File

@ -11,6 +11,7 @@ Simple compression
use libc::{c_void, size_t, c_int};
extern mod rustrt {
#[legacy_exports];
fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
src_buf_len: size_t,

View File

@ -52,6 +52,7 @@ const neg_infinity: float = -1.0/0.0;
/* Module: consts */
mod consts {
#[legacy_exports];
// FIXME (requires Issue #1433 to fix): replace with mathematical
// constants from cmath.

View File

@ -180,6 +180,7 @@ proto! future_pipe (
#[allow(non_implicitly_copyable_typarams)]
mod test {
#[legacy_exports];
#[test]
fn test_from_value() {
let f = from_value(~"snail");

View File

@ -47,6 +47,7 @@ struct StackSegment {
}
extern mod rustrt {
#[legacy_exports];
fn rust_annihilate_box(ptr: *Word);
#[rust_stack]

View File

@ -17,6 +17,7 @@ type fd_t = c_int;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn rust_get_stdin() -> *libc::FILE;
fn rust_get_stdout() -> *libc::FILE;
fn rust_get_stderr() -> *libc::FILE;
@ -781,6 +782,7 @@ fn read_whole_file(file: &Path) -> Result<~[u8], ~str> {
// fsync related
mod fsync {
#[legacy_exports];
enum Level {
// whatever fsync does on that platform
@ -863,6 +865,7 @@ mod fsync {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_simple() {

View File

@ -131,18 +131,22 @@ export access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
mod types {
#[legacy_exports];
// Types tend to vary *per architecture* so we pull their definitions out
// into this module.
// Standard types that are opaque or common, so are not per-target.
mod common {
#[legacy_exports];
mod c95 {
#[legacy_exports];
enum c_void {}
enum FILE {}
enum fpos_t {}
}
mod c99 {
#[legacy_exports];
type int8_t = i8;
type int16_t = i16;
type int32_t = i32;
@ -153,21 +157,28 @@ mod types {
type uint64_t = u64;
}
mod posix88 {
#[legacy_exports];
enum DIR {}
enum dirent {}
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
}
// Standard types that are scalar but vary by OS and arch.
#[cfg(target_os = "linux")]
mod os {
#[legacy_exports];
#[cfg(target_arch = "x86")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -186,12 +197,14 @@ mod types {
type wchar_t = i32;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i32;
type dev_t = u64;
type ino_t = u32;
@ -202,16 +215,22 @@ mod types {
type mode_t = u32;
type ssize_t = i32;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
}
}
#[cfg(target_arch = "x86_64")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -230,12 +249,14 @@ mod types {
type wchar_t = i32;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i64;
type dev_t = u64;
type ino_t = u64;
@ -246,19 +267,26 @@ mod types {
type mode_t = u32;
type ssize_t = i64;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
}
}
}
#[cfg(target_os = "freebsd")]
mod os {
#[legacy_exports];
#[cfg(target_arch = "x86_64")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -277,12 +305,14 @@ mod types {
type wchar_t = i32;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i64;
type dev_t = u32;
type ino_t = u32;
@ -293,19 +323,26 @@ mod types {
type mode_t = u16;
type ssize_t = i64;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
}
}
}
#[cfg(target_os = "win32")]
mod os {
#[legacy_exports];
#[cfg(target_arch = "x86")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -324,12 +361,14 @@ mod types {
type wchar_t = u16;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i32;
type dev_t = u32;
type ino_t = i16;
@ -338,10 +377,14 @@ mod types {
type mode_t = u16;
type ssize_t = i32;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
type BOOL = c_int;
type BYTE = u8;
type CCHAR = c_char;
@ -377,9 +420,12 @@ mod types {
#[cfg(target_os = "macos")]
mod os {
#[legacy_exports];
#[cfg(target_arch = "x86")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -398,12 +444,14 @@ mod types {
type wchar_t = i32;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i64;
type dev_t = i32;
type ino_t = u64;
@ -414,16 +462,22 @@ mod types {
type mode_t = u16;
type ssize_t = i32;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
}
}
#[cfg(target_arch = "x86_64")]
mod arch {
#[legacy_exports];
mod c95 {
#[legacy_exports];
type c_char = i8;
type c_schar = i8;
type c_uchar = u8;
@ -442,12 +496,14 @@ mod types {
type wchar_t = i32;
}
mod c99 {
#[legacy_exports];
type c_longlong = i64;
type c_ulonglong = u64;
type intptr_t = int;
type uintptr_t = uint;
}
mod posix88 {
#[legacy_exports];
type off_t = i64;
type dev_t = i32;
type ino_t = u64;
@ -458,23 +514,30 @@ mod types {
type mode_t = u16;
type ssize_t = i64;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
}
}
}
}
mod consts {
#[legacy_exports];
// Consts tend to vary per OS so we pull their definitions out
// into this module.
#[cfg(target_os = "win32")]
mod os {
#[legacy_exports];
mod c95 {
#[legacy_exports];
const EXIT_FAILURE : int = 1;
const EXIT_SUCCESS : int = 0;
const RAND_MAX : int = 32767;
@ -491,8 +554,10 @@ mod consts {
const L_tmpnam : uint = 16_u;
const TMP_MAX : uint = 32767_u;
}
mod c99 { }
mod c99 {
#[legacy_exports]; }
mod posix88 {
#[legacy_exports];
const O_RDONLY : int = 0;
const O_WRONLY : int = 1;
const O_RDWR : int = 2;
@ -521,10 +586,14 @@ mod consts {
const STDOUT_FILENO : int = 1;
const STDERR_FILENO : int = 2;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
const O_TEXT : int = 16384;
const O_BINARY : int = 32768;
const O_NOINHERIT: int = 128;
@ -537,7 +606,9 @@ mod consts {
#[cfg(target_os = "linux")]
mod os {
#[legacy_exports];
mod c95 {
#[legacy_exports];
const EXIT_FAILURE : int = 1;
const EXIT_SUCCESS : int = 0;
const RAND_MAX : int = 2147483647;
@ -554,8 +625,10 @@ mod consts {
const L_tmpnam : uint = 20_u;
const TMP_MAX : uint = 238328_u;
}
mod c99 { }
mod c99 {
#[legacy_exports]; }
mod posix88 {
#[legacy_exports];
const O_RDONLY : int = 0;
const O_WRONLY : int = 1;
const O_RDWR : int = 2;
@ -588,10 +661,14 @@ mod consts {
const F_TLOCK : int = 2;
const F_ULOCK : int = 0;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
const O_RSYNC : int = 1052672;
const O_DSYNC : int = 4096;
const O_SYNC : int = 1052672;
@ -600,7 +677,9 @@ mod consts {
#[cfg(target_os = "freebsd")]
mod os {
#[legacy_exports];
mod c95 {
#[legacy_exports];
const EXIT_FAILURE : int = 1;
const EXIT_SUCCESS : int = 0;
const RAND_MAX : int = 2147483647;
@ -617,8 +696,10 @@ mod consts {
const L_tmpnam : uint = 1024_u;
const TMP_MAX : uint = 308915776_u;
}
mod c99 { }
mod c99 {
#[legacy_exports]; }
mod posix88 {
#[legacy_exports];
const O_RDONLY : int = 0;
const O_WRONLY : int = 1;
const O_RDWR : int = 2;
@ -651,10 +732,14 @@ mod consts {
const F_TLOCK : int = 2;
const F_ULOCK : int = 0;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
const O_SYNC : int = 128;
const CTL_KERN: int = 1;
const KERN_PROC: int = 14;
@ -664,7 +749,9 @@ mod consts {
#[cfg(target_os = "macos")]
mod os {
#[legacy_exports];
mod c95 {
#[legacy_exports];
const EXIT_FAILURE : int = 1;
const EXIT_SUCCESS : int = 0;
const RAND_MAX : int = 2147483647;
@ -681,8 +768,10 @@ mod consts {
const L_tmpnam : uint = 1024_u;
const TMP_MAX : uint = 308915776_u;
}
mod c99 { }
mod c99 {
#[legacy_exports]; }
mod posix88 {
#[legacy_exports];
const O_RDONLY : int = 0;
const O_WRONLY : int = 1;
const O_RDWR : int = 2;
@ -715,10 +804,14 @@ mod consts {
const F_TLOCK : int = 2;
const F_ULOCK : int = 0;
}
mod posix01 { }
mod posix08 { }
mod bsd44 { }
mod posix01 {
#[legacy_exports]; }
mod posix08 {
#[legacy_exports]; }
mod bsd44 {
#[legacy_exports]; }
mod extra {
#[legacy_exports];
const O_DSYNC : int = 4194304;
const O_SYNC : int = 128;
const F_FULLFSYNC : int = 51;
@ -728,15 +821,18 @@ mod consts {
mod funcs {
#[legacy_exports];
// Thankfull most of c95 is universally available and does not vary by OS
// or anything. The same is not true of POSIX.
mod c95 {
#[legacy_exports];
#[nolink]
#[abi = "cdecl"]
extern mod ctype {
#[legacy_exports];
fn isalnum(c: c_int) -> c_int;
fn isalpha(c: c_int) -> c_int;
fn iscntrl(c: c_int) -> c_int;
@ -755,6 +851,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod stdio {
#[legacy_exports];
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
fn freopen(filename: *c_char, mode: *c_char,
@ -799,6 +896,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod stdlib {
#[legacy_exports];
fn abs(i: c_int) -> c_int;
fn labs(i: c_long) -> c_long;
// Omitted: div, ldiv (return type incomplete).
@ -824,6 +922,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod string {
#[legacy_exports];
fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
fn strncpy(dst: *c_char, src: *c_char, n: size_t) -> *c_char;
@ -858,10 +957,12 @@ mod funcs {
#[cfg(target_os = "win32")]
mod posix88 {
#[legacy_exports];
#[nolink]
#[abi = "cdecl"]
extern mod stat {
#[legacy_exports];
#[link_name = "_chmod"]
fn chmod(path: *c_char, mode: c_int) -> c_int;
@ -872,6 +973,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod stdio {
#[legacy_exports];
#[link_name = "_popen"]
fn popen(command: *c_char, mode: *c_char) -> *FILE;
@ -888,6 +990,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod fcntl {
#[legacy_exports];
#[link_name = "_open"]
fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
@ -898,12 +1001,14 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod dirent {
#[legacy_exports];
// Not supplied at all.
}
#[nolink]
#[abi = "cdecl"]
extern mod unistd {
#[legacy_exports];
#[link_name = "_access"]
fn access(path: *c_char, amode: c_int) -> c_int;
@ -968,10 +1073,12 @@ mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
mod posix88 {
#[legacy_exports];
#[nolink]
#[abi = "cdecl"]
extern mod stat {
#[legacy_exports];
fn chmod(path: *c_char, mode: mode_t) -> c_int;
fn fchmod(fd: c_int, mode: mode_t) -> c_int;
fn mkdir(path: *c_char, mode: mode_t) -> c_int;
@ -981,6 +1088,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod stdio {
#[legacy_exports];
fn popen(command: *c_char, mode: *c_char) -> *FILE;
fn pclose(stream: *FILE) -> c_int;
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
@ -990,6 +1098,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod fcntl {
#[legacy_exports];
fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
fn creat(path: *c_char, mode: mode_t) -> c_int;
fn fcntl(fd: c_int, cmd: c_int) -> c_int;
@ -998,6 +1107,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod dirent {
#[legacy_exports];
fn opendir(dirname: *c_char) -> *DIR;
fn closedir(dirp: *DIR) -> c_int;
fn readdir(dirp: *DIR) -> *dirent;
@ -1009,6 +1119,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod unistd {
#[legacy_exports];
fn access(path: *c_char, amode: c_int) -> c_int;
fn alarm(seconds: c_uint) -> c_uint;
fn chdir(dir: *c_char) -> c_int;
@ -1058,10 +1169,12 @@ mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
mod posix01 {
#[legacy_exports];
#[nolink]
#[abi = "cdecl"]
extern mod unistd {
#[legacy_exports];
fn readlink(path: *c_char, buf: *mut c_char,
bufsz: size_t) -> ssize_t;
@ -1079,6 +1192,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod wait {
#[legacy_exports];
fn waitpid(pid: pid_t, status: *mut c_int,
options: c_int) -> pid_t;
}
@ -1086,8 +1200,10 @@ mod funcs {
#[cfg(target_os = "win32")]
mod posix01 {
#[legacy_exports];
#[nolink]
extern mod unistd { }
extern mod unistd {
#[legacy_exports]; }
}
@ -1096,8 +1212,10 @@ mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
mod posix08 {
#[legacy_exports];
#[nolink]
extern mod unistd { }
extern mod unistd {
#[legacy_exports]; }
}
@ -1106,6 +1224,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod bsd44 {
#[legacy_exports];
fn sysctl(name: *c_int, namelen: c_uint,
oldp: *mut c_void, oldlenp: *mut size_t,
@ -1123,6 +1242,7 @@ mod funcs {
#[cfg(target_os = "linux")]
#[cfg(target_os = "win32")]
mod bsd44 {
#[legacy_exports];
}
@ -1130,23 +1250,28 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
extern mod extra {
#[legacy_exports];
fn _NSGetExecutablePath(buf: *mut c_char,
bufsize: *mut u32) -> c_int;
}
#[cfg(target_os = "freebsd")]
mod extra { }
mod extra {
#[legacy_exports]; }
#[cfg(target_os = "linux")]
mod extra { }
mod extra {
#[legacy_exports]; }
#[cfg(target_os = "win32")]
mod extra {
#[legacy_exports];
use types::os::arch::extra::*;
#[abi = "stdcall"]
extern mod kernel32 {
#[legacy_exports];
fn GetEnvironmentVariableW(n: LPCWSTR,
v: LPWSTR,
nsize: DWORD) -> DWORD;
@ -1171,6 +1296,7 @@ mod funcs {
#[abi = "cdecl"]
#[nolink]
extern mod msvcrt {
#[legacy_exports];
#[link_name = "_commit"]
fn commit(fd: c_int) -> c_int;
}

View File

@ -8,6 +8,7 @@ export console_on, console_off;
#[nolink]
extern mod rustrt {
#[legacy_exports];
fn rust_log_console_on();
fn rust_log_console_off();
}

View File

@ -44,6 +44,7 @@ export walk_dir;
export as_c_charp, fill_charp_buf;
extern mod rustrt {
#[legacy_exports];
fn rust_getcwd() -> ~str;
fn rust_path_is_dir(path: *libc::c_char) -> c_int;
fn rust_path_exists(path: *libc::c_char) -> c_int;
@ -78,6 +79,7 @@ fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool)
#[cfg(windows)]
mod win32 {
#[legacy_exports];
use dword = libc::types::os::arch::extra::DWORD;
fn fill_utf16_buf_and_decode(f: fn(*mut u16, dword) -> dword)
@ -131,6 +133,7 @@ fn env() -> ~[(~str,~str)] {
}
mod global_env {
#[legacy_exports];
//! Internal module for serializing access to getenv/setenv
export getenv;
@ -138,6 +141,7 @@ mod global_env {
export env;
extern mod rustrt {
#[legacy_exports];
fn rust_global_env_chan_ptr() -> *libc::uintptr_t;
}
@ -204,7 +208,9 @@ mod global_env {
}
mod impl_ {
#[legacy_exports];
extern mod rustrt {
#[legacy_exports];
fn rust_env_pairs() -> ~[~str];
}
@ -791,6 +797,7 @@ fn family() -> ~str { ~"windows" }
#[cfg(target_os = "macos")]
mod consts {
#[legacy_exports];
fn sysname() -> ~str { ~"macos" }
fn exe_suffix() -> ~str { ~"" }
fn dll_suffix() -> ~str { ~".dylib" }
@ -798,6 +805,7 @@ mod consts {
#[cfg(target_os = "freebsd")]
mod consts {
#[legacy_exports];
fn sysname() -> ~str { ~"freebsd" }
fn exe_suffix() -> ~str { ~"" }
fn dll_suffix() -> ~str { ~".so" }
@ -805,6 +813,7 @@ mod consts {
#[cfg(target_os = "linux")]
mod consts {
#[legacy_exports];
fn sysname() -> ~str { ~"linux" }
fn exe_suffix() -> ~str { ~"" }
fn dll_suffix() -> ~str { ~".so" }
@ -812,6 +821,7 @@ mod consts {
#[cfg(target_os = "win32")]
mod consts {
#[legacy_exports];
fn sysname() -> ~str { ~"win32" }
fn exe_suffix() -> ~str { ~".exe" }
fn dll_suffix() -> ~str { ~".dll" }
@ -829,6 +839,7 @@ fn arch() -> str { ~"arm" }
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
#[legacy_exports];
#[test]
fn last_os_error() {

View File

@ -484,6 +484,7 @@ fn test_double_slash_collapsing()
}
mod posix {
#[legacy_exports];
#[cfg(test)]
fn mk(s: &str) -> PosixPath { from_str::<PosixPath>(s) }
@ -574,6 +575,7 @@ mod posix {
// Various windows helpers, and tests for the impl.
mod windows {
#[legacy_exports];
#[inline(always)]
pure fn is_sep(u: u8) -> bool {

View File

@ -268,6 +268,7 @@ fn entangle_buffer<T: Send, Tstart: Send>(
#[abi = "rust-intrinsic"]
#[doc(hidden)]
extern mod rusti {
#[legacy_exports];
fn atomic_xchg(dst: &mut int, src: int) -> int;
fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
@ -308,6 +309,7 @@ type rust_task = libc::c_void;
#[doc(hidden)]
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
fn rust_get_task() -> *rust_task;
#[rust_stack]
@ -1224,6 +1226,7 @@ fn try_send_one<T: Send>(+chan: ChanOne<T>, +data: T)
}
mod rt {
#[legacy_exports];
// These are used to hide the option constructors from the
// compiler because their names are changing
fn make_some<T>(+val: T) -> Option<T> { Some(move val) }
@ -1232,6 +1235,7 @@ mod rt {
#[cfg(test)]
mod test {
#[legacy_exports];
#[test]
fn test_select2() {
let (c1, p1) = pipes::stream();

View File

@ -16,6 +16,7 @@ use task::TaskBuilder;
use task::atomically;
extern mod rustrt {
#[legacy_exports];
fn rust_task_weaken(ch: rust_port_id);
fn rust_task_unweaken(ch: rust_port_id);
@ -558,6 +559,7 @@ fn unwrap_exclusive<T: Send>(+arc: Exclusive<T>) -> T {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn exclusive_arc() {

View File

@ -27,6 +27,7 @@ use libc::{c_void, size_t};
#[nolink]
#[abi = "cdecl"]
extern mod libc_ {
#[legacy_exports];
#[rust_stack]
fn memcpy(dest: *mut c_void, src: *const c_void,
n: libc::size_t) -> *c_void;
@ -42,6 +43,7 @@ extern mod libc_ {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn addr_of<T>(val: T) -> *T;
}

View File

@ -8,6 +8,7 @@ enum rctx {}
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn rand_seed() -> ~[u8];
fn rand_new() -> *rctx;
fn rand_new_seeded(seed: ~[u8]) -> *rctx;
@ -309,6 +310,7 @@ fn seeded_xorshift(x: u32, y: u32, z: u32, w: u32) -> Rng {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn rng_seeded() {

View File

@ -401,6 +401,7 @@ impl<T:Eq,U:Eq> Result<T,U> : Eq {
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
#[legacy_exports];
fn op1() -> result::Result<int, ~str> { result::Ok(666) }
fn op2(&&i: int) -> result::Result<uint, ~str> {

View File

@ -14,6 +14,7 @@ use gc::{cleanup_stack_for_failure, gc, Word};
type rust_task = c_void;
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
fn rust_upcall_fail(expr: *c_char, file: *c_char, line: size_t);

View File

@ -16,6 +16,7 @@ export waitpid;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn rust_run_program(argv: **libc::c_char, envp: *c_void,
dir: *libc::c_char,
in_fd: c_int, out_fd: c_int, err_fd: c_int)
@ -401,6 +402,7 @@ fn waitpid(pid: pid_t) -> int {
#[cfg(test)]
mod tests {
#[legacy_exports];
use io::WriterUtil;

View File

@ -28,6 +28,7 @@ trait SendMap<K:Eq Hash, V: Copy> {
/// Open addressing with linear probing.
mod linear {
#[legacy_exports];
export LinearMap, linear_map, linear_map_with_capacity, public_methods;
const initial_capacity: uint = 32u; // 2^5
@ -362,6 +363,7 @@ mod linear {
#[test]
mod test {
#[legacy_exports];
use linear::LinearMap;

View File

@ -79,10 +79,12 @@ fn frame_address(f: fn(*u8)) {
}
extern mod rustrt {
#[legacy_exports];
fn rust_dbg_breakpoint();
}
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn frame_address(f: fn(*u8));
}

View File

@ -2040,6 +2040,7 @@ pure fn escape_unicode(s: &str) -> ~str {
/// Unsafe operations
mod raw {
#[legacy_exports];
export
from_buf,
from_buf_len,
@ -2233,6 +2234,7 @@ impl ~str: UniqueStr {
#[cfg(notest)]
mod traits {
#[legacy_exports];
#[cfg(stage0)]
impl ~str: Add<&str,~str> {
#[inline(always)]
@ -2251,7 +2253,8 @@ mod traits {
}
#[cfg(test)]
mod traits {}
mod traits {
#[legacy_exports];}
trait StrSlice {
fn all(it: fn(char) -> bool) -> bool;
@ -2396,6 +2399,7 @@ impl &str: StrSlice {
#[cfg(test)]
mod tests {
#[legacy_exports];
use libc::c_char;

View File

@ -38,6 +38,7 @@ struct Closure {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn get_tydesc<T>() -> *();
fn size_of<T>() -> uint;
fn pref_align_of<T>() -> uint;
@ -111,6 +112,7 @@ pure fn log_str<T>(t: &T) -> ~str {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn size_of_basic() {

View File

@ -1178,6 +1178,7 @@ fn test_spawn_sched_childs_on_same_sched() {
#[nolink]
#[cfg(test)]
extern mod testrt {
#[legacy_exports];
fn rust_dbg_lock_create() -> *libc::c_void;
fn rust_dbg_lock_destroy(lock: *libc::c_void);
fn rust_dbg_lock_lock(lock: *libc::c_void);

View File

@ -101,6 +101,7 @@ impl<A: ToStr> ~A: ToStr {
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
#[legacy_exports];
#[test]
fn test_simple_types() {
assert 1.to_str() == ~"1";

View File

@ -4,6 +4,7 @@
#[forbid(deprecated_pattern)];
mod general_category {
#[legacy_exports];
pure fn Cc(c: char) -> bool {
return match c {
'\x00' .. '\x1f'
@ -2564,6 +2565,7 @@ mod general_category {
}
mod derived_property {
#[legacy_exports];
/// Check if a character has the alphabetic unicode property
pure fn Alphabetic(c: char) -> bool {
return match c {

View File

@ -93,6 +93,7 @@ fn unreachable() -> ! {
}
mod tests {
#[legacy_exports];
#[test]
fn identity_crisis() {
// Writing a test for the identity function. How did it come to this?

View File

@ -97,6 +97,7 @@ export traits;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn vec_reserve_shared(++t: *sys::TypeDesc,
++v: **raw::VecRepr,
++n: libc::size_t);
@ -104,6 +105,7 @@ extern mod rustrt {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn move_val_init<T>(&dst: T, -src: T);
}
@ -1535,6 +1537,7 @@ impl<T: Ord> @[T] : Ord {
#[cfg(notest)]
mod traits {
#[legacy_exports];
#[cfg(stage0)]
impl<T: Copy> ~[T]: Add<&[const T],~[T]> {
#[inline(always)]
@ -1570,7 +1573,8 @@ mod traits {
}
#[cfg(test)]
mod traits {}
mod traits {
#[legacy_exports];}
trait ConstVector {
pure fn is_empty() -> bool;
@ -1744,6 +1748,7 @@ impl<T: Copy> &[T]: ImmutableCopyableVector<T> {
/// Unsafe operations
mod raw {
#[legacy_exports];
// FIXME: This should have crate visibility (#1893 blocks that)
/// The internal representation of a (boxed) vector
@ -1888,6 +1893,7 @@ mod raw {
/// Operations on `[u8]`
mod bytes {
#[legacy_exports];
export cmp;
export lt, le, eq, ne, ge, gt;
export memcpy, memmove;
@ -2017,6 +2023,7 @@ impl<A: Copy Ord> &[A]: iter::CopyableOrderedIter<A> {
#[cfg(test)]
mod tests {
#[legacy_exports];
fn square(n: uint) -> uint { return n * n; }

View File

@ -444,6 +444,7 @@ impl<T: Const Send> &RWReadMode<T> {
#[cfg(test)]
mod tests {
#[legacy_exports];
use comm::*;
#[test]

View File

@ -34,10 +34,12 @@ use libc::size_t;
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn move_val_init<T>(&dst: T, -src: T);
fn needs_drop<T>() -> bool;
}
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
fn rust_call_tydesc_glue(root: *u8, tydesc: *TypeDesc, field: size_t);
}

View File

@ -137,6 +137,7 @@ impl ~str: FromBase64 {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_to_base64() {
assert (~"").to_base64() == ~"";

View File

@ -563,6 +563,7 @@ impl Bitv: ops::Index<uint,bool> {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_to_str() {
let zerolen = Bitv(0u, false);

View File

@ -138,6 +138,7 @@ unsafe fn ptr<T>(t: CVec<T>) -> *mut T {
#[cfg(test)]
mod tests {
#[legacy_exports];
use libc::*;
fn malloc(n: size_t) -> CVec<u8> {

View File

@ -66,6 +66,7 @@ fn DuplexStream<T: Send, U: Send>()
#[cfg(test)]
mod test {
#[legacy_exports];
#[test]
fn DuplexStream1() {
let (left, right) = DuplexStream();

View File

@ -14,6 +14,7 @@ export breakpoint;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn debug_tydesc(td: *sys::TypeDesc);
fn debug_opaque(td: *sys::TypeDesc, x: *());
fn debug_box(td: *sys::TypeDesc, x: *());

View File

@ -120,6 +120,7 @@ fn create<T: Copy>() -> Deque<T> {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_simple() {
let d: deque::Deque<int> = deque::create::<int>();

View File

@ -496,6 +496,7 @@ impl FailType : Eq {
#[cfg(test)]
mod tests {
#[legacy_exports];
use opt = getopts;
use result::{Err, Ok};

View File

@ -858,6 +858,7 @@ impl Error: to_str::ToStr {
#[cfg(test)]
mod tests {
#[legacy_exports];
fn mk_dict(items: &[(~str, Json)]) -> Json {
let d = map::HashMap();

View File

@ -192,6 +192,7 @@ impl<T:Eq> List<T> : Eq {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_is_empty() {

View File

@ -83,6 +83,7 @@ trait Map<K:Eq IterBytes Hash Copy, V: Copy> {
}
mod util {
#[legacy_exports];
type Rational = {num: int, den: int}; // : int::positive(*.den);
pure fn rational_leq(x: Rational, y: Rational) -> bool {
@ -96,6 +97,7 @@ mod util {
// FIXME (#2344): package this up and export it as a datatype usable for
// external code that doesn't want to pay the cost of a box.
mod chained {
#[legacy_exports];
export T, mk, HashMap;
const initial_capacity: uint = 32u; // 2^5
@ -518,6 +520,7 @@ impl<K: Eq IterBytes Hash Copy, V: Copy> @Mut<LinearMap<K, V>>:
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_simple() {

View File

@ -118,6 +118,7 @@ fn get_addr(node: &str, iotask: iotask)
}
mod v4 {
#[legacy_exports];
/**
* Convert a str to `ip_addr`
*
@ -204,6 +205,7 @@ mod v4 {
}
}
mod v6 {
#[legacy_exports];
/**
* Convert a str to `ip_addr`
*
@ -310,6 +312,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
#[cfg(test)]
mod test {
#[legacy_exports];
#[test]
fn test_ip_ipv4_parse_and_format_ip() {
let localhost_str = ~"127.0.0.1";

View File

@ -26,6 +26,7 @@ export connect;
#[nolink]
extern mod rustrt {
#[legacy_exports];
fn rust_uv_current_kernel_malloc(size: libc::c_uint) -> *libc::c_void;
fn rust_uv_current_kernel_free(mem: *libc::c_void);
fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint;
@ -1222,13 +1223,16 @@ type TcpBufferedSocketData = {
//#[cfg(test)]
mod test {
#[legacy_exports];
// FIXME don't run on fbsd or linux 32 bit (#2064)
#[cfg(target_os="win32")]
#[cfg(target_os="darwin")]
#[cfg(target_os="linux")]
mod tcp_ipv4_server_and_client_test {
#[legacy_exports];
#[cfg(target_arch="x86_64")]
mod impl64 {
#[legacy_exports];
#[test]
fn test_gl_tcp_server_and_client_ipv4() unsafe {
impl_gl_tcp_ipv4_server_and_client();
@ -1253,6 +1257,7 @@ mod test {
}
#[cfg(target_arch="x86")]
mod impl32 {
#[legacy_exports];
#[test]
#[ignore(cfg(target_os = "linux"))]
fn test_gl_tcp_server_and_client_ipv4() unsafe {

View File

@ -786,6 +786,7 @@ impl Url: IterBytes {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_split_char_first() {
let (u,v) = split_char_first(~"hello, sweet world", ',');

View File

@ -431,7 +431,9 @@ fn loop_leaves(rope: Rope, it: fn(node::Leaf) -> bool) -> bool{
}
mod iterator {
#[legacy_exports];
mod leaf {
#[legacy_exports];
fn start(rope: Rope) -> node::leaf_iterator::T {
match (rope) {
node::Empty => return node::leaf_iterator::empty(),
@ -443,6 +445,7 @@ mod iterator {
}
}
mod char {
#[legacy_exports];
fn start(rope: Rope) -> node::char_iterator::T {
match (rope) {
node::Empty => return node::char_iterator::empty(),
@ -535,6 +538,7 @@ fn char_at(rope: Rope, pos: uint) -> char {
Section: Implementation
*/
mod node {
#[legacy_exports];
/// Implementation of type `rope`
enum Root {
@ -1105,6 +1109,7 @@ mod node {
}
mod leaf_iterator {
#[legacy_exports];
type T = {
stack: ~[mut @Node],
mut stackpos: int
@ -1142,6 +1147,7 @@ mod node {
}
mod char_iterator {
#[legacy_exports];
type T = {
leaf_iterator: leaf_iterator::T,
mut leaf: Option<Leaf>,
@ -1219,6 +1225,7 @@ mod node {
#[cfg(test)]
mod tests {
#[legacy_exports];
//Utility function, used for sanity check
fn rope_to_string(r: Rope) -> ~str {

View File

@ -262,6 +262,7 @@ fn sha1() -> Sha1 {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test() unsafe {

View File

@ -171,6 +171,7 @@ impl<T: Copy Ord Eq> &[mut T] : Sort {
#[cfg(test)]
mod test_qsort3 {
#[legacy_exports];
fn check_sort(v1: &[mut int], v2: &[mut int]) {
let len = vec::len::<int>(v1);
quick_sort3::<int>(v1);
@ -210,6 +211,7 @@ mod test_qsort3 {
#[cfg(test)]
mod test_qsort {
#[legacy_exports];
fn check_sort(v1: &[mut int], v2: &[mut int]) {
let len = vec::len::<int>(v1);
pure fn leual(a: &int, b: &int) -> bool { *a <= *b }
@ -269,6 +271,7 @@ mod test_qsort {
#[cfg(test)]
mod tests {
#[legacy_exports];
fn check_sort(v1: &[int], v2: &[int]) {
let len = vec::len::<int>(v1);

View File

@ -19,6 +19,7 @@ not required in or otherwise suitable for the core library.
#[no_core];
#[legacy_modes];
#[legacy_exports];
#[allow(vecs_implicitly_copyable)];
#[deny(non_camel_case_types)];
@ -41,66 +42,107 @@ export cell;
// General io and system-services modules
#[legacy_exports]
mod net;
#[legacy_exports]
mod net_ip;
#[legacy_exports]
mod net_tcp;
#[legacy_exports]
mod net_url;
// libuv modules
#[legacy_exports]
mod uv;
#[legacy_exports]
mod uv_ll;
#[legacy_exports]
mod uv_iotask;
#[legacy_exports]
mod uv_global_loop;
// Utility modules
#[legacy_exports]
mod c_vec;
#[legacy_exports]
mod timer;
#[legacy_exports]
mod cell;
// Concurrency
#[legacy_exports]
mod sync;
#[legacy_exports]
mod arc;
#[legacy_exports]
mod comm;
// Collections
#[legacy_exports]
mod bitv;
#[legacy_exports]
mod deque;
#[legacy_exports]
mod fun_treemap;
#[legacy_exports]
mod list;
#[legacy_exports]
mod map;
#[legacy_exports]
mod rope;
#[legacy_exports]
mod smallintmap;
#[legacy_exports]
mod sort;
#[legacy_exports]
mod treemap;
#[legacy_exports]
// And ... other stuff
#[legacy_exports]
mod ebml;
#[legacy_exports]
mod dbg;
#[legacy_exports]
mod getopts;
#[legacy_exports]
mod json;
#[legacy_exports]
mod sha1;
#[legacy_exports]
mod md4;
#[legacy_exports]
mod tempfile;
#[legacy_exports]
mod term;
#[legacy_exports]
mod time;
#[legacy_exports]
mod prettyprint;
#[legacy_exports]
mod arena;
#[legacy_exports]
mod par;
#[legacy_exports]
mod cmp;
#[legacy_exports]
mod base64;
#[cfg(unicode)]
#[legacy_exports]
mod unicode;
// Compiler support modules
#[legacy_exports]
mod test;
#[legacy_exports]
mod serialization;
// Local Variables:

View File

@ -670,6 +670,7 @@ impl &RWlockReadMode {
#[cfg(test)]
mod tests {
#[legacy_exports];
/************************************************************************
* Semaphore tests
************************************************************************/

View File

@ -29,6 +29,7 @@ export run_tests_console;
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn rust_sched_threads() -> libc::size_t;
}
@ -428,6 +429,7 @@ fn calc_result(test: &TestDesc, task_succeeded: bool) -> TestResult {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn do_not_run_ignored_tests() {

View File

@ -22,6 +22,7 @@ export
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
fn get_time(&sec: i64, &nsec: i32);
fn precise_time_ns(&ns: u64);
@ -884,6 +885,7 @@ impl Tm {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_get_time() {

View File

@ -147,6 +147,7 @@ extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) unsafe {
#[cfg(test)]
mod test {
#[legacy_exports];
#[test]
fn test_gl_timer_simple_sleep_test() {
let hl_loop = uv::global_loop::get();

View File

@ -87,6 +87,7 @@ fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn init_treemap() { let _m = TreeMap::<int, int>(); }

View File

@ -2,6 +2,7 @@
#[forbid(deprecated_pattern)];
mod icu {
#[legacy_exports];
type UBool = u8;
type UProperty = int;
type UChar32 = char;
@ -151,6 +152,7 @@ mod icu {
#[link_name = "icuuc"]
#[abi = "cdecl"]
extern mod libicu {
#[legacy_exports];
pure fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
pure fn u_isdigit(c: UChar32) -> UBool;
pure fn u_islower(c: UChar32) -> UBool;
@ -209,6 +211,7 @@ pure fn is_upper(c: char) -> bool {
#[cfg(test)]
mod tests {
#[legacy_exports];
#[test]
fn test_is_digit() {

View File

@ -16,6 +16,7 @@ use task::TaskBuilder;
use either::{Left, Right};
extern mod rustrt {
#[legacy_exports];
fn rust_uv_get_kernel_global_chan_ptr() -> *libc::uintptr_t;
}
@ -112,6 +113,7 @@ fn spawn_loop() -> IoTask {
#[cfg(test)]
mod test {
#[legacy_exports];
extern fn simple_timer_close_cb(timer_ptr: *ll::uv_timer_t) unsafe {
let exit_ch_ptr = ll::get_data_for_uv_handle(
timer_ptr as *libc::c_void) as *comm::Chan<bool>;

View File

@ -171,6 +171,7 @@ extern fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
#[cfg(test)]
mod test {
#[legacy_exports];
extern fn async_close_cb(handle: *ll::uv_async_t) unsafe {
log(debug, fmt!("async_close_cb handle %?", handle));
let exit_ch = (*(ll::get_data_for_uv_handle(handle)

View File

@ -247,6 +247,7 @@ type sockaddr_in6 = {
type addr_in = addr_in_impl::addr_in;
#[cfg(unix)]
mod addr_in_impl {
#[legacy_exports];
#[cfg(target_arch="x86_64")]
type addr_in = {
a0: *u8, a1: *u8,
@ -262,6 +263,7 @@ mod addr_in_impl {
}
#[cfg(windows)]
mod addr_in_impl {
#[legacy_exports];
type addr_in = {
a0: *u8, a1: *u8,
a2: *u8, a3: *u8
@ -272,6 +274,7 @@ mod addr_in_impl {
type addrinfo = addrinfo_impl::addrinfo;
#[cfg(target_os="linux")]
mod addrinfo_impl {
#[legacy_exports];
#[cfg(target_arch="x86_64")]
type addrinfo = {
a00: *u8, a01: *u8, a02: *u8, a03: *u8,
@ -286,6 +289,7 @@ mod addrinfo_impl {
#[cfg(target_os="macos")]
#[cfg(target_os="freebsd")]
mod addrinfo_impl {
#[legacy_exports];
type addrinfo = {
a00: *u8, a01: *u8, a02: *u8, a03: *u8,
a04: *u8, a05: *u8
@ -293,6 +297,7 @@ mod addrinfo_impl {
}
#[cfg(windows)]
mod addrinfo_impl {
#[legacy_exports];
type addrinfo = {
a00: *u8, a01: *u8, a02: *u8, a03: *u8,
a04: *u8, a05: *u8
@ -306,6 +311,7 @@ type uv_getaddrinfo_t = {
};
mod uv_ll_struct_stubgen {
#[legacy_exports];
fn gen_stub_uv_tcp_t() -> uv_tcp_t {
return gen_stub_os();
#[cfg(target_os = "linux")]
@ -561,6 +567,7 @@ mod uv_ll_struct_stubgen {
#[nolink]
extern mod rustrt {
#[legacy_exports];
// libuv public API
fn rust_uv_loop_new() -> *libc::c_void;
fn rust_uv_loop_delete(lp: *libc::c_void);
@ -1002,6 +1009,7 @@ unsafe fn addrinfo_as_sockaddr_in6(input: *addrinfo) -> *sockaddr_in6 {
#[cfg(test)]
mod test {
#[legacy_exports];
enum tcp_read_data {
tcp_read_eof,
tcp_read_more(~[u8]),
@ -1503,8 +1511,10 @@ mod test {
#[cfg(target_os="darwin")]
#[cfg(target_os="linux")]
mod tcp_and_server_client_test {
#[legacy_exports];
#[cfg(target_arch="x86_64")]
mod impl64 {
#[legacy_exports];
#[test]
fn test_uv_ll_tcp_server_and_request() unsafe {
impl_uv_tcp_server_and_request();
@ -1512,6 +1522,7 @@ mod test {
}
#[cfg(target_arch="x86")]
mod impl32 {
#[legacy_exports];
#[test]
#[ignore(cfg(target_os = "linux"))]
fn test_uv_ll_tcp_server_and_request() unsafe {

View File

@ -78,6 +78,7 @@ export expand;
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
#[legacy_exports];
pub use ext;
pub use parse;
}

View File

@ -10,6 +10,7 @@ use ext::base::mk_ctxt;
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
#[legacy_exports];
pub use ext;
pub use parse;
}

View File

@ -16,6 +16,7 @@ use ast_builder::{append_types, path, empty_span};
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
#[legacy_exports];
pub use ext;
pub use parse;
}
@ -318,7 +319,7 @@ impl protocol: gen_init {
}
};
cx.parse_item(fmt!("fn init%s() -> (client::%s, server::%s)\
cx.parse_item(fmt!("pub fn init%s() -> (client::%s, server::%s)\
{ use pipes::HasBuffer; %s }",
start_state.ty_params.to_source(cx),
start_state.to_ty(cx).to_source(cx),

View File

@ -279,6 +279,7 @@ pure fn is_bar(t: token) -> bool {
mod special_idents {
#[legacy_exports];
use ast::ident;
const underscore : ident = 0u;
const anon : ident = 1u;

View File

@ -127,7 +127,7 @@ fn fun_to_str(decl: ast::fn_decl, name: ast::ident,
params: ~[ast::ty_param], intr: ident_interner) -> ~str {
do io::with_str_writer |wr| {
let s = rust_printer(wr, intr);
print_fn(s, decl, None, name, params, None);
print_fn(s, decl, None, name, params, None, ast::inherited);
end(s); // Close the head box
end(s); // Close the outer box
eof(s.s);
@ -420,7 +420,8 @@ fn print_foreign_item(s: ps, item: @ast::foreign_item) {
print_outer_attributes(s, item.attrs);
match item.node {
ast::foreign_item_fn(decl, purity, typarams) => {
print_fn(s, decl, Some(purity), item.ident, typarams, None);
print_fn(s, decl, Some(purity), item.ident, typarams, None,
ast::inherited);
end(s); // end head-ibox
word(s.s, ~";");
end(s); // end the outer fn box
@ -444,7 +445,7 @@ fn print_item(s: ps, &&item: @ast::item) {
s.ann.pre(ann_node);
match item.node {
ast::item_const(ty, expr) => {
head(s, ~"const");
head(s, visibility_qualified(item.vis, ~"const"));
print_ident(s, item.ident);
word_space(s, ~":");
print_type(s, ty);
@ -458,12 +459,13 @@ fn print_item(s: ps, &&item: @ast::item) {
}
ast::item_fn(decl, purity, typarams, body) => {
print_fn(s, decl, Some(purity), item.ident, typarams, None);
print_fn(s, decl, Some(purity), item.ident, typarams, None,
item.vis);
word(s.s, ~" ");
print_block_with_attrs(s, body, item.attrs);
}
ast::item_mod(_mod) => {
head(s, ~"mod");
head(s, visibility_qualified(item.vis, ~"mod"));
print_ident(s, item.ident);
nbsp(s);
bopen(s);
@ -471,7 +473,7 @@ fn print_item(s: ps, &&item: @ast::item) {
bclose(s, item.span);
}
ast::item_foreign_mod(nmod) => {
head(s, ~"extern");
head(s, visibility_qualified(item.vis, ~"extern"));
match nmod.sort {
ast::named => {
word_nbsp(s, ~"mod");
@ -614,6 +616,30 @@ fn print_variants(s: ps, variants: ~[ast::variant], span: ast::span) {
bclose(s, span);
}
fn visibility_to_str(vis: ast::visibility) -> ~str {
match vis {
ast::private => ~"priv",
ast::public => ~"pub",
ast::inherited => ~""
}
}
fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
match vis {
ast::private | ast::public =>
visibility_to_str(vis) + " " + s,
ast::inherited => s
}
}
fn print_visibility(s: ps, vis: ast::visibility) {
match vis {
ast::private | ast::public =>
word_nbsp(s, visibility_to_str(vis)),
ast::inherited => ()
}
}
fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
ident: ast::ident, span: ast::span) {
print_ident(s, ident);
@ -651,9 +677,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
ast::named_field(ident, mutability, visibility) => {
hardbreak_if_not_bol(s);
maybe_print_comment(s, field.span.lo);
if visibility == ast::private {
word_nbsp(s, ~"priv");
}
print_visibility(s, visibility);
if mutability == ast::class_mutable {
word_nbsp(s, ~"mut");
}
@ -710,6 +734,7 @@ fn print_tt(s: ps, tt: ast::token_tree) {
}
fn print_variant(s: ps, v: ast::variant) {
print_visibility(s, v.node.vis);
match v.node.kind {
ast::tuple_variant_kind(args) => {
print_ident(s, v.node.name);
@ -762,7 +787,8 @@ fn print_method(s: ps, meth: @ast::method) {
maybe_print_comment(s, meth.span.lo);
print_outer_attributes(s, meth.attrs);
print_fn(s, meth.decl, Some(meth.purity),
meth.ident, meth.tps, Some(meth.self_ty.node));
meth.ident, meth.tps, Some(meth.self_ty.node),
meth.vis);
word(s.s, ~" ");
print_block_with_attrs(s, meth.body, meth.attrs);
}
@ -1224,7 +1250,8 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
cbox(s, indent_unit);
// head-box, will be closed by print-block at start
ibox(s, 0u);
word(s.s, fn_header_info_to_str(None, None, Some(proto)));
word(s.s, fn_header_info_to_str(None, None, Some(proto),
ast::inherited));
print_fn_args_and_ret(s, decl, *cap_clause, None);
space(s.s);
print_block(s, body);
@ -1587,8 +1614,9 @@ fn print_self_ty(s: ps, self_ty: ast::self_ty_) -> bool {
fn print_fn(s: ps, decl: ast::fn_decl, purity: Option<ast::purity>,
name: ast::ident,
typarams: ~[ast::ty_param],
opt_self_ty: Option<ast::self_ty_>) {
head(s, fn_header_info_to_str(opt_self_ty, purity, None));
opt_self_ty: Option<ast::self_ty_>,
vis: ast::visibility) {
head(s, fn_header_info_to_str(opt_self_ty, purity, None, vis));
print_ident(s, name);
print_type_params(s, typarams);
print_fn_args_and_ret(s, decl, ~[], opt_self_ty);
@ -1758,6 +1786,7 @@ fn print_view_item(s: ps, item: @ast::view_item) {
hardbreak_if_not_bol(s);
maybe_print_comment(s, item.span.lo);
print_outer_attributes(s, item.attrs);
print_visibility(s, item.vis);
match item.node {
ast::view_item_use(id, mta, _) => {
head(s, ~"extern mod");
@ -1827,7 +1856,8 @@ fn print_ty_fn(s: ps, opt_proto: Option<ast::proto>, purity: ast::purity,
tps: Option<~[ast::ty_param]>,
opt_self_ty: Option<ast::self_ty_>) {
ibox(s, indent_unit);
word(s.s, fn_header_info_to_str(opt_self_ty, Some(purity), opt_proto));
word(s.s, fn_header_info_to_str(opt_self_ty, Some(purity), opt_proto,
ast::inherited));
print_bounds(s, bounds);
match id { Some(id) => { word(s.s, ~" "); print_ident(s, id); } _ => () }
match tps { Some(tps) => print_type_params(s, tps), _ => () }
@ -2050,10 +2080,14 @@ fn next_comment(s: ps) -> Option<comments::cmnt> {
fn fn_header_info_to_str(opt_sty: Option<ast::self_ty_>,
opt_purity: Option<ast::purity>,
opt_p: Option<ast::proto>) -> ~str {
let mut s = match opt_sty {
Some(ast::sty_static) => ~"static ",
_ => ~ ""
opt_p: Option<ast::proto>,
vis: ast::visibility) -> ~str {
let mut s = visibility_qualified(vis, ~"");
match opt_sty {
Some(ast::sty_static) => str::push_str(s, ~"static "),
_ => ()
};
match opt_purity {

View File

@ -9,6 +9,7 @@
#[no_core];
#[legacy_modes];
#[legacy_exports];
#[allow(vecs_implicitly_copyable)];
#[allow(non_camel_case_types)];
@ -18,19 +19,31 @@ extern mod std(vers = "0.4");
use core::*;
#[legacy_exports]
mod attr;
#[legacy_exports]
mod diagnostic;
#[legacy_exports]
mod codemap;
#[legacy_exports]
mod ast;
#[legacy_exports]
mod ast_util;
#[legacy_exports]
mod ast_map;
#[legacy_exports]
mod visit;
#[legacy_exports]
mod fold;
#[legacy_exports]
mod util {
#[legacy_exports];
#[legacy_exports]
mod interner;
}
mod parse {
#[legacy_exports];
export parser;
export common;
export lexer;
@ -40,61 +53,100 @@ mod parse {
export classify;
export attr;
#[legacy_exports]
mod eval;
#[legacy_exports]
mod lexer;
#[legacy_exports]
mod parser;
#[legacy_exports]
mod token;
#[legacy_exports]
mod comments;
#[legacy_exports]
mod attr;
#[legacy_exports]
/// Common routines shared by parser mods
#[legacy_exports]
mod common;
/// Functions dealing with operator precedence
#[legacy_exports]
mod prec;
/// Routines the parser uses to classify AST nodes
#[legacy_exports]
mod classify;
/// Reporting obsolete syntax
#[legacy_exports]
mod obsolete;
}
mod print {
#[legacy_exports];
#[legacy_exports]
mod pp;
#[legacy_exports]
mod pprust;
}
mod ext {
#[legacy_exports];
#[legacy_exports]
mod base;
#[legacy_exports]
mod expand;
#[legacy_exports]
mod qquote;
#[legacy_exports]
mod build;
mod tt {
#[legacy_exports];
#[legacy_exports]
mod transcribe;
#[legacy_exports]
mod macro_parser;
#[legacy_exports]
mod macro_rules;
}
#[legacy_exports]
mod simplext;
#[legacy_exports]
mod fmt;
#[legacy_exports]
mod env;
#[legacy_exports]
mod concat_idents;
#[legacy_exports]
mod ident_to_str;
#[legacy_exports]
mod log_syntax;
#[legacy_exports]
mod auto_serialize;
#[legacy_exports]
mod source_util;
mod pipes {
#[legacy_exports];
#[legacy_exports]
mod ast_builder;
#[legacy_exports]
mod parse_proto;
#[legacy_exports]
mod pipec;
#[legacy_exports]
mod proto;
#[legacy_exports]
mod check;
#[legacy_exports]
mod liveness;
}
#[legacy_exports]
mod trace_macros;
}

View File

@ -65,9 +65,11 @@ fn WriteOutputFile(sess:session,
}
mod jit {
#[legacy_exports];
#[nolink]
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn morestack_addr() -> *();
}
@ -99,6 +101,7 @@ mod jit {
}
mod write {
#[legacy_exports];
fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
if ot == output_type_assembly || ot == output_type_object ||
ot == output_type_exe {

View File

@ -181,6 +181,7 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
#[cfg(unix)]
mod test {
#[legacy_exports];
#[test]
fn test_rpaths_to_flags() {
let flags = rpaths_to_flags(~[Path("path1"),

View File

@ -745,6 +745,7 @@ fn list_metadata(sess: session, path: &Path, out: io::Writer) {
#[cfg(test)]
mod test {
#[legacy_exports];
// When the user supplies --test we should implicitly supply --cfg test
#[test]

View File

@ -338,6 +338,7 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
#[cfg(test)]
mod test {
#[legacy_exports];
use syntax::ast_util;
fn make_crate_type_attr(t: ~str) -> ast::attribute {

View File

@ -2,6 +2,7 @@
// and injected into each crate the compiler builds. Keep it small.
mod intrinsic {
#[legacy_exports];
pub use rusti::visit_tydesc;
@ -113,6 +114,7 @@ mod intrinsic {
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn get_tydesc<T>() -> *();
fn visit_tydesc(td: *TyDesc, &&tv: TyVisitor);
}

View File

@ -174,6 +174,7 @@ fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod {
We're going to be building a module that looks more or less like:
mod __test {
#[legacy_exports];
fn main(args: ~[str]) -> int {
std::test::test_main(args, tests())

View File

@ -274,6 +274,7 @@ type SectionIteratorRef = *SectionIterator_opaque;
#[link_name = "rustllvm"]
#[abi = "cdecl"]
extern mod llvm {
#[legacy_exports];
/* Create and destroy contexts. */
fn LLVMContextCreate() -> ContextRef;
fn LLVMGetGlobalContext() -> ContextRef;

View File

@ -3,23 +3,29 @@
// no dependencies on rustc it can move into its own crate.
mod middle {
#[legacy_exports];
pub use middle_::ty;
pub use middle_::resolve;
}
mod front {
#[legacy_exports];
}
mod back {
#[legacy_exports];
}
mod driver {
#[legacy_exports];
}
mod util {
#[legacy_exports];
pub use util_::ppaux;
}
mod lib {
#[legacy_exports];
pub use lib_::llvm;
}

View File

@ -50,6 +50,7 @@ struct LanguageItems {
}
mod LanguageItems {
#[legacy_exports];
fn make() -> LanguageItems {
LanguageItems {
const_trait: None,

View File

@ -483,6 +483,13 @@ struct Module {
exported_names: HashMap<Atom,node_id>,
// XXX: This is a transition measure to let us switch export-evaluation
// logic when compiling modules that have transitioned to listing their
// pub/priv qualifications on items, explicitly, rather than using the
// old export rule.
legacy_exports: bool,
// The status of resolving each import in this module.
import_resolutions: HashMap<Atom,@ImportResolution>,
@ -493,7 +500,9 @@ struct Module {
mut resolved_import_count: uint,
}
fn Module(parent_link: ParentLink, def_id: Option<def_id>) -> Module {
fn Module(parent_link: ParentLink,
def_id: Option<def_id>,
legacy_exports: bool) -> Module {
Module {
parent_link: parent_link,
def_id: def_id,
@ -501,6 +510,7 @@ fn Module(parent_link: ParentLink, def_id: Option<def_id>) -> Module {
imports: DVec(),
anonymous_children: HashMap(),
exported_names: atom_hashmap(),
legacy_exports: legacy_exports,
import_resolutions: atom_hashmap(),
glob_count: 0u,
resolved_import_count: 0u
@ -577,10 +587,12 @@ struct NameBindings {
impl NameBindings {
/// Creates a new module in this set of name bindings.
fn define_module(parent_link: ParentLink, def_id: Option<def_id>,
fn define_module(parent_link: ParentLink,
def_id: Option<def_id>,
legacy_exports: bool,
sp: span) {
if self.module_def.is_none() {
let module_ = @Module(parent_link, def_id);
let module_ = @Module(parent_link, def_id, legacy_exports);
self.module_def = ModuleDef(module_);
self.module_span = Some(sp);
}
@ -728,6 +740,18 @@ fn namespace_to_str(ns: Namespace) -> ~str {
}
}
fn has_legacy_export_attr(attrs: &[syntax::ast::attribute]) -> bool {
for attrs.each |attribute| {
match attribute.node.value.node {
syntax::ast::meta_word(w) if w == ~"legacy_exports" => {
return true;
}
_ => {}
}
}
return false;
}
fn Resolver(session: session, lang_items: LanguageItems,
crate: @crate) -> Resolver {
@ -735,6 +759,7 @@ fn Resolver(session: session, lang_items: LanguageItems,
(*graph_root).define_module(NoParentLink,
Some({ crate: 0, node: 0 }),
has_legacy_export_attr(crate.node.attrs),
crate.span);
let current_module = (*graph_root).get_module();
@ -885,10 +910,18 @@ impl Resolver {
}));
}
fn visibility_to_privacy(visibility: visibility) -> Privacy {
match visibility {
inherited | public => Public,
private => Private
fn visibility_to_privacy(visibility: visibility,
legacy_exports: bool) -> Privacy {
if legacy_exports {
match visibility {
inherited | public => Public,
private => Private
}
} else {
match visibility {
public => Public,
inherited | private => Private
}
}
}
@ -1009,16 +1042,20 @@ impl Resolver {
let atom = item.ident;
let sp = item.span;
let legacy = match parent {
ModuleReducedGraphParent(m) => m.legacy_exports
};
match item.node {
item_mod(module_) => {
let legacy = has_legacy_export_attr(item.attrs);
let (name_bindings, new_parent) = self.add_child(atom, parent,
~[ModuleNS], sp);
let parent_link = self.get_parent_link(new_parent, atom);
let def_id = { crate: 0, node: item.id };
(*name_bindings).define_module(parent_link, Some(def_id),
sp);
legacy, sp);
let new_parent =
ModuleReducedGraphParent((*name_bindings).get_module());
@ -1026,6 +1063,7 @@ impl Resolver {
visit_mod(module_, sp, item.id, new_parent, visitor);
}
item_foreign_mod(fm) => {
let legacy = has_legacy_export_attr(item.attrs);
let new_parent = match fm.sort {
named => {
let (name_bindings, new_parent) = self.add_child(atom,
@ -1034,7 +1072,7 @@ impl Resolver {
let parent_link = self.get_parent_link(new_parent, atom);
let def_id = { crate: 0, node: item.id };
(*name_bindings).define_module(parent_link, Some(def_id),
sp);
legacy, sp);
ModuleReducedGraphParent((*name_bindings).get_module())
}
@ -1052,7 +1090,7 @@ impl Resolver {
~[ValueNS], sp);
(*name_bindings).define_value
(self.visibility_to_privacy(item.vis),
(self.visibility_to_privacy(item.vis, legacy),
def_const(local_def(item.id)),
sp);
}
@ -1062,7 +1100,7 @@ impl Resolver {
let def = def_fn(local_def(item.id), purity);
(*name_bindings).define_value
(self.visibility_to_privacy(item.vis), def, sp);
(self.visibility_to_privacy(item.vis, legacy), def, sp);
visit_item(item, new_parent, visitor);
}
@ -1072,7 +1110,7 @@ impl Resolver {
~[TypeNS], sp);
(*name_bindings).define_type
(self.visibility_to_privacy(item.vis),
(self.visibility_to_privacy(item.vis, legacy),
def_ty(local_def(item.id)),
sp);
}
@ -1083,7 +1121,7 @@ impl Resolver {
~[TypeNS], sp);
(*name_bindings).define_type
(self.visibility_to_privacy(item.vis),
(self.visibility_to_privacy(item.vis, legacy),
def_ty(local_def(item.id)),
sp);
@ -1104,7 +1142,7 @@ impl Resolver {
self.add_child(atom, parent, ~[TypeNS], sp);
(*name_bindings).define_type
(self.visibility_to_privacy(item.vis),
(self.visibility_to_privacy(item.vis, legacy),
def_ty(local_def(item.id)),
sp);
new_parent
@ -1114,7 +1152,8 @@ impl Resolver {
self.add_child(atom, parent, ~[ValueNS, TypeNS],
sp);
let privacy = self.visibility_to_privacy(item.vis);
let privacy = self.visibility_to_privacy(item.vis,
legacy);
(*name_bindings).define_type
(privacy, def_ty(local_def(item.id)), sp);
@ -1171,7 +1210,7 @@ impl Resolver {
self.trait_info.insert(def_id, method_names);
(*name_bindings).define_type
(self.visibility_to_privacy(item.vis),
(self.visibility_to_privacy(item.vis, legacy),
def_ty(def_id),
sp);
visit_item(item, new_parent, visitor);
@ -1190,10 +1229,14 @@ impl Resolver {
parent: ReducedGraphParent,
&&visitor: vt<ReducedGraphParent>) {
let legacy = match parent {
ModuleReducedGraphParent(m) => m.legacy_exports
};
let atom = variant.node.name;
let (child, _) = self.add_child(atom, parent, ~[ValueNS],
variant.span);
let privacy = self.visibility_to_privacy(variant.node.vis);
let privacy = self.visibility_to_privacy(variant.node.vis, legacy);
match variant.node.kind {
tuple_variant_kind(_) => {
@ -1228,6 +1271,7 @@ impl Resolver {
fn build_reduced_graph_for_view_item(view_item: @view_item,
parent: ReducedGraphParent,
&&_visitor: vt<ReducedGraphParent>) {
match view_item.node {
view_item_import(view_paths) => {
for view_paths.each |view_path| {
@ -1368,6 +1412,7 @@ impl Resolver {
(*child_name_bindings).define_module(parent_link,
Some(def_id),
false,
view_item.span);
self.build_reduced_graph_for_external_crate
((*child_name_bindings).get_module());
@ -1424,7 +1469,7 @@ impl Resolver {
let parent_module = self.get_module_from_parent(parent);
let new_module = @Module(BlockParentLink(parent_module, block_id),
None);
None, false);
parent_module.anonymous_children.insert(block_id, new_module);
new_parent = ModuleReducedGraphParent(new_module);
} else {
@ -1451,6 +1496,7 @@ impl Resolver {
None => {
child_name_bindings.define_module(parent_link,
Some(def_id),
false,
dummy_sp());
modules.insert(def_id,
child_name_bindings.get_module());
@ -1594,7 +1640,8 @@ impl Resolver {
let parent_link = self.get_parent_link(new_parent,
ident);
(*child_name_bindings).define_module(parent_link,
None, dummy_sp());
None, false,
dummy_sp());
}
ModuleDef(_) => { /* Fall through. */ }
}
@ -2554,8 +2601,9 @@ impl Resolver {
}
fn name_is_exported(module_: @Module, name: Atom) -> bool {
return module_.exported_names.size() == 0u ||
module_.exported_names.contains_key(name);
return !module_.legacy_exports ||
module_.exported_names.size() == 0u ||
module_.exported_names.contains_key(name);
}
/**

View File

@ -37,102 +37,188 @@ use middle_ = middle;
use back_ = back;
mod middle {
#[legacy_exports];
mod trans {
#[legacy_exports];
#[legacy_exports]
mod inline;
#[legacy_exports]
mod monomorphize;
#[legacy_exports]
mod controlflow;
#[legacy_exports]
mod glue;
#[legacy_exports]
mod datum;
#[legacy_exports]
mod callee;
#[legacy_exports]
mod expr;
#[legacy_exports]
mod common;
#[legacy_exports]
mod consts;
#[legacy_exports]
mod type_of;
#[legacy_exports]
mod build;
#[legacy_exports]
mod base;
#[legacy_exports]
mod alt;
#[legacy_exports]
mod uniq;
#[legacy_exports]
mod closure;
#[legacy_exports]
mod tvec;
#[legacy_exports]
mod meth;
#[legacy_exports]
mod foreign;
#[legacy_exports]
mod reflect;
#[legacy_exports]
mod shape;
#[legacy_exports]
mod debuginfo;
#[legacy_exports]
mod type_use;
#[legacy_exports]
mod reachable;
}
#[legacy_exports]
mod ty;
#[legacy_exports]
mod resolve;
mod typeck {
#[legacy_exports];
mod check {
#[legacy_exports];
#[legacy_exports]
mod alt;
#[legacy_exports]
mod vtable;
#[legacy_exports]
mod writeback;
#[legacy_exports]
mod regionmanip;
#[legacy_exports]
mod regionck;
#[legacy_exports]
mod demand;
#[legacy_exports]
mod method;
}
#[legacy_exports]
mod rscope;
#[legacy_exports]
mod astconv;
mod infer {
#[legacy_exports];
#[legacy_exports]
mod assignment;
#[legacy_exports]
mod combine;
#[legacy_exports]
mod glb;
#[legacy_exports]
mod integral;
#[legacy_exports]
mod lattice;
#[legacy_exports]
mod lub;
#[legacy_exports]
mod region_var_bindings;
#[legacy_exports]
mod resolve;
#[legacy_exports]
mod sub;
#[legacy_exports]
mod to_str;
#[legacy_exports]
mod unify;
}
#[legacy_exports]
mod collect;
#[legacy_exports]
mod coherence;
}
#[legacy_exports]
mod check_loop;
#[legacy_exports]
mod check_alt;
#[legacy_exports]
mod check_const;
#[legacy_exports]
mod lint;
mod borrowck {
#[legacy_exports];
#[legacy_exports]
mod check_loans;
#[legacy_exports]
mod gather_loans;
#[legacy_exports]
mod loan;
#[legacy_exports]
mod preserve;
}
#[legacy_exports]
mod mem_categorization;
#[legacy_exports]
mod liveness;
#[legacy_exports]
mod kind;
#[legacy_exports]
mod freevars;
#[legacy_exports]
mod capture;
#[legacy_exports]
mod pat_util;
#[legacy_exports]
mod region;
#[legacy_exports]
mod const_eval;
#[legacy_exports]
mod astencode;
#[legacy_exports]
mod lang_items;
#[legacy_exports]
mod privacy;
}
mod front {
#[legacy_exports];
#[legacy_exports]
mod config;
#[legacy_exports]
mod test;
#[legacy_exports]
mod core_inject;
#[legacy_exports]
mod intrinsic_inject;
}
mod back {
#[legacy_exports];
#[legacy_exports]
mod link;
#[legacy_exports]
mod abi;
#[legacy_exports]
mod upcall;
#[legacy_exports]
mod x86;
#[legacy_exports]
mod x86_64;
#[legacy_exports]
mod rpath;
#[legacy_exports]
mod target_strs;
}
mod metadata {
#[legacy_exports];
export encoder;
export creader;
export cstore;
@ -144,29 +230,47 @@ mod metadata {
export loader;
export filesearch;
#[legacy_exports]
mod common;
#[legacy_exports]
mod tyencode;
#[legacy_exports]
mod tydecode;
#[legacy_exports]
mod encoder;
#[legacy_exports]
mod decoder;
#[legacy_exports]
mod creader;
#[legacy_exports]
mod cstore;
#[legacy_exports]
mod csearch;
#[legacy_exports]
mod loader;
#[legacy_exports]
mod filesearch;
}
mod driver {
#[legacy_exports];
#[legacy_exports]
mod driver;
#[legacy_exports]
mod session;
}
mod util {
#[legacy_exports];
#[legacy_exports]
mod common;
#[legacy_exports]
mod ppaux;
}
mod lib {
#[legacy_exports];
#[legacy_exports]
mod llvm;
}

View File

@ -19,6 +19,7 @@ type CrateAttrs = {
#[cfg(test)]
mod test {
#[legacy_exports];
fn parse_attributes(source: ~str) -> ~[ast::attribute] {
use syntax::parse;

View File

@ -290,6 +290,7 @@ fn should_extract_impl_method_docs() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, ~"");

View File

@ -294,6 +294,7 @@ fn should_error_with_no_pandoc() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn parse_config(args: ~[~str]) -> Result<Config, ~str> {
parse_config_(args, mock_program_output)
}

View File

@ -63,6 +63,7 @@ fn take_my_order_please(
}
mod fortress_of_solitude {
#[legacy_exports];
/*!
* Superman's vacation home
*
@ -77,6 +78,7 @@ mod fortress_of_solitude {
}
mod blade_runner {
#[legacy_exports];
/*!
* Blade Runner is probably the best movie ever
*

View File

@ -83,6 +83,7 @@ fn should_promote_impl_method_desc() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, ~"");

View File

@ -328,6 +328,7 @@ fn should_extract_struct_fields() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(source: ~str) -> doc::Doc {
let ast = parse::from_str(source);
@ -377,7 +378,8 @@ mod test {
fn extract_fns() {
let doc = mk_doc(
~"fn a() { } \
mod b { fn c() { } }");
mod b {
#[legacy_exports]; fn c() { } }");
assert doc.cratemod().fns()[0].name() == ~"a";
assert doc.cratemod().mods()[0].fns()[0].name() == ~"c";
}

View File

@ -226,6 +226,7 @@ fn should_index_foreign_mod_contents() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(output_style: config::OutputStyle, source: ~str) -> doc::Doc {
do astsrv::from_str(source) |srv| {
let config = {

View File

@ -61,7 +61,8 @@ fn should_write_modules_last() {
let markdown = test::render(
~"mod a { }\
fn b() { }\
mod c { }\
mod c {
#[legacy_exports]; }\
fn d() { }"
);
@ -334,7 +335,8 @@ fn should_write_sections() {
~"#[doc = \"\
# Header\n\
Body\"]\
mod a { }");
mod a {
#[legacy_exports]; }");
assert str::contains(markdown, ~"#### Header\n\nBody\n\n");
}
@ -795,6 +797,7 @@ fn should_write_struct_header() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn render(source: ~str) -> ~str {
let (srv, doc) = create_doc_srv(source);
let markdown = write_markdown_str_srv(srv, doc);

View File

@ -244,6 +244,7 @@ fn should_name_mod_file_names_by_path() {
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(name: ~str, source: ~str) -> doc::Doc {
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, name);

Some files were not shown because too many files have changed in this diff Show More