diff options
| author | bors <bors@rust-lang.org> | 2014-05-07 11:06:45 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-07 11:06:45 -0700 |
| commit | 87115fd001440652291c509a77bda74fa511dab0 (patch) | |
| tree | 06de178943c0e48728df22b090dcdc1b9ba9a9d2 /src/libstd/lib.rs | |
| parent | 445988b47811679144d0fa9b3a2ccf2348752850 (diff) | |
| parent | 07caa224501817c93be3f5c57a013ed5db6c04e1 (diff) | |
| download | rust-87115fd001440652291c509a77bda74fa511dab0.tar.gz rust-87115fd001440652291c509a77bda74fa511dab0.zip | |
auto merge of #13901 : alexcrichton/rust/facade, r=brson
This is the second step in implementing #13851. This PR cannot currently land until a snapshot exists with #13892, but I imagine that this review will take longer. This PR refactors a large amount of functionality outside of the standard library into a new library, libcore. This new library has 0 dependencies (in theory). In practice, this library currently depends on these symbols being available: * `rust_begin_unwind` and `rust_fail_bounds_check` - These are the two entry points of failure in libcore. The symbols are provided by libstd currently. In the future (see the bullets on #13851) this will be officially supported with nice error mesages. Additionally, there will only be one failure entry point once `std::fmt` migrates to libcore. * `memcpy` - This is often generated by LLVM. This is also quite trivial to implement for any platform, so I'm not too worried about this. * `memcmp` - This is required for comparing strings. This function is quite common *everywhere*, so I don't feel to bad about relying on a consumer of libcore to define it. * `malloc` and `free` - This is quite unfortunate, and is a temporary stopgap until we deal with the `~` situation. More details can be found in the module `core::should_not_exist` * `fmod` and `fmodf` - These exist because the `Rem` trait is defined in libcore, so the `Rem` implementation for floats must also be defined in libcore. I imagine that any platform using floating-point modulus will have these symbols anyway, and otherwise they will be optimized out. * `fdim` and `fdimf` - Like `fmod`, these are from the `Signed` trait being defined in libcore. I don't expect this to be much of a problem These dependencies all "Just Work" for now because libcore only exists as an rlib, not as a dylib. The commits themselves are organized to show that the overall diff of this extraction is not all that large. Most modules were able to be moved with very few modifications. The primary module left out of this iteration is `std::fmt`. I plan on migrating the `fmt` module to libcore, but I chose to not do so at this time because it had implications on the `Writer` trait that I wanted to deal with in isolation. There are a few breaking changes in these commits, but they are fairly minor, and are all labeled with `[breaking-change]`. The nastiest parts of this movement come up with `~[T]` and `~str` being language-defined types today. I believe that much of this nastiness will get better over time as we migrate towards `Vec<T>` and `Str` (or whatever the types will be named). There will likely always be some extension traits, but the situation won't be as bad as it is today. Known deficiencies: * rustdoc will get worse in terms of readability. This is the next issue I will tackle as part of #13851. If others think that the rustdoc change should happen first, I can also table this to fix rustdoc first. * The compiler reveals that all these types are reexports via error messages like `core::option::Option`. This is filed as #13065, and I believe that issue would have a higher priority now. I do not currently plan on fixing that as part of #13851. If others believe that this issue should be fixed, I can also place it on the roadmap for #13851. I recommend viewing these changes on a commit-by-commit basis. The overall change is likely too overwhelming to take in.
Diffstat (limited to 'src/libstd/lib.rs')
| -rw-r--r-- | src/libstd/lib.rs | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index bf24bf405a0..72d41ae1dd2 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -122,8 +122,8 @@ // Make and rand accessible for benchmarking/testcases #[cfg(test)] extern crate rand; -// we wrap some libc stuff extern crate libc; +extern crate core; // Make std testable by not duplicating lang items. See #2912 #[cfg(test)] extern crate realstd = "std"; @@ -133,6 +133,27 @@ extern crate libc; #[cfg(test)] pub use ty = realstd::ty; #[cfg(test)] pub use owned = realstd::owned; +#[cfg(not(test))] pub use cmp = core::cmp; +#[cfg(not(test))] pub use kinds = core::kinds; +#[cfg(not(test))] pub use ops = core::ops; +#[cfg(not(test))] pub use owned = core::owned; +#[cfg(not(test))] pub use ty = core::ty; + +pub use core::any; +pub use core::bool; +pub use core::cast; +pub use core::cell; +pub use core::char; +pub use core::clone; +pub use core::container; +pub use core::default; +pub use core::intrinsics; +pub use core::iter; +pub use core::mem; +pub use core::ptr; +pub use core::raw; +pub use core::tuple; + // Run tests with libgreen instead of libnative. // // FIXME: This egregiously hacks around starting the test runner in a different @@ -176,11 +197,6 @@ pub mod prelude; #[path = "num/f32.rs"] pub mod f32; #[path = "num/f64.rs"] pub mod f64; -pub mod unit; -pub mod bool; -pub mod char; -pub mod tuple; - pub mod slice; pub mod vec; pub mod str; @@ -188,40 +204,20 @@ pub mod strbuf; pub mod ascii; -pub mod ptr; -mod managed; -mod reference; pub mod rc; pub mod gc; - -/* Core language traits */ - -#[cfg(not(test))] pub mod kinds; -#[cfg(not(test))] pub mod ops; -#[cfg(not(test))] pub mod cmp; -#[cfg(not(test))] pub mod ty; -#[cfg(not(test))] pub mod owned; - - /* Common traits */ pub mod from_str; pub mod num; -pub mod iter; pub mod to_str; -pub mod clone; pub mod hash; -pub mod container; -pub mod default; -pub mod any; /* Common data structures */ -pub mod option; pub mod result; -pub mod cell; - +pub mod option; /* Tasks and communication */ @@ -238,11 +234,8 @@ pub mod c_vec; pub mod os; pub mod io; pub mod path; -pub mod cast; pub mod fmt; pub mod cleanup; -pub mod mem; - /* Unsupported interfaces */ @@ -254,10 +247,6 @@ pub mod reflect; // Private APIs #[unstable] pub mod unstable; -#[experimental] -pub mod intrinsics; -#[experimental] -pub mod raw; /* For internal use, not exported */ |
