Commit Graph

28697 Commits

Author SHA1 Message Date
bors
87115fd001 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.
2014-05-07 11:06:45 -07:00
Alex Crichton
07caa22450 Test fixes and rebase conflicts 2014-05-07 11:03:12 -07:00
Michael Woerister
55a8bd56e5 debuginfo: Split debuginfo autotests into debuginfo-gdb and debuginfo-lldb 2014-05-07 19:58:07 +02:00
Alex Crichton
a289ebefb8 Register new snapshots
This is the first snapshot with support to mix rlib and dylib dependencies.
2014-05-07 08:17:32 -07:00
Alex Crichton
0d8f5fa618 core: Move Option::expect to libstd from libcore
See #14008 for more details
2014-05-07 08:17:32 -07:00
Alex Crichton
4a974413dc core: Fix an unsigned negation warning 2014-05-07 08:17:05 -07:00
Alex Crichton
255908ac95 test: Update with std => core movement 2014-05-07 08:17:05 -07:00
Alex Crichton
104e285eb8 core: Get coretest working
This mostly involved frobbing imports between realstd, realcore, and the core
being test. Some of the imports are a little counterintuitive, but it mainly
focuses around libcore's types not implementing Show while libstd's types
implement Show.
2014-05-07 08:16:42 -07:00
Alex Crichton
f62c121eb0 core: Inherit the cell module 2014-05-07 08:16:14 -07:00
Alex Crichton
d4b5d82a33 core: Add unwrap()/unwrap_err() methods to Result
These implementations must live in libstd right now because the fmt module has
not been migrated yet. This will occur in a later PR.

Just to be clear, there are new extension traits, but they are not necessary
once the std::fmt module has migrated to libcore, which is a planned migration
in the future.
2014-05-07 08:16:14 -07:00
Alex Crichton
a156534a96 core: Inherit the result module
The unwrap()/unwrap_err() methods are temporarily removed, and will be added
back in the next commit.
2014-05-07 08:16:14 -07:00
Alex Crichton
f12b51705b core: Remove generics from Option::expect
The prospects of a generic failure function such as this existing in libcore are
bleak, due to monomorphization not working across the crate boundary, and
allocation into a ~Any is not allowed in libcore.

The argument to expect() is now &str instead of <M: Send + Any>

[breaking-change]
2014-05-07 08:16:14 -07:00
Alex Crichton
e4271cae54 core: Add a limited implementation of failure
This adds an small of failure to libcore, hamstrung by the fact that std::fmt
hasn't been migrated yet. A few asserts were re-worked to not use std::fmt
features, but these asserts can go back to their original form once std::fmt has
migrated.

The current failure implementation is to just have some symbols exposed by
std::rt::unwind that are linked against by libcore. This is an explicit circular
dependency, unfortunately. This will be officially supported in the future
through compiler support with much nicer failure messages. Additionally, there
are two depended-upon symbols today, but in the future there will only be one
(once std::fmt has migrated).
2014-05-07 08:16:14 -07:00
Alex Crichton
4686cf2018 core: Bring char/finally test style up to date 2014-05-07 08:16:14 -07:00
Alex Crichton
c9447c5d95 core: Allow some #[deriving] in libcore 2014-05-07 08:16:14 -07:00
Alex Crichton
e0d43b023e core: Implement necessary traits for ~[T]/~str
Coherence requires that libcore's traits be implemented in libcore for ~[T] and
~str (due to them being language defined types). These implementations cannot
live in libcore forever, but for now, until Heap/Box/Uniq is a lang item, these
implementations must reside inside of libcore. While not perfect
implementations, these shouldn't reside in libcore for too long.

With some form of lang item these implementations can be in a proper crate
because the lang item will not be present in libcore.
2014-05-07 08:16:14 -07:00
Alex Crichton
c67ebf1ef3 std: Remove a glob to get std to compile 2014-05-07 08:16:14 -07:00
Alex Crichton
9bae6ec828 core: Inherit possible string functionality
This moves as much allocation as possible from teh std::str module into
core::str. This includes essentially all non-allocating functionality, mostly
iterators and slicing and such.

This primarily splits the Str trait into only having the as_slice() method,
adding a new StrAllocating trait to std::str which contains the relevant new
allocation methods. This is a breaking change if any of the methods of "trait
Str" were overriden. The old functionality can be restored by implementing both
the Str and StrAllocating traits.

[breaking-change]
2014-05-07 08:16:14 -07:00
Alex Crichton
544d909401 core: Inherit necessary unicode functionality
The unicode module remains private, but the normalization iterators require an
allocation, so some functionality needs to remain in libstd
2014-05-07 08:15:58 -07:00
Alex Crichton
91ede1f09a core: Inherit non-allocating slice functionality
This commit adds a new trait, MutableVectorAllocating, which represents
functions on vectors which can allocate.

This is another extension trait to slices which should be removed once a lang
item exists for the ~ allocation.
2014-05-07 08:15:58 -07:00
Alex Crichton
be0a11729e core: Inherit the specific numeric modules
This implements all traits inside of core::num for all the primitive types,
removing all the functionality from libstd. The std modules reexport all of the
necessary items from the core modules.
2014-05-07 08:15:58 -07:00
Alex Crichton
0c30293886 core: Inherit what's possible from the num module
This strips out all string-related functionality from the num module. The
inherited functionality is all that will be implemented in libcore (for now).
Primarily, libcore will not implement the Float trait or any string-related
functionality.

It may be possible to migrate string parsing functionality into libcore in the
future, but for now it will remain in libstd.

All functionality in core::num is reexported in std::num.
2014-05-07 08:15:58 -07:00
Alex Crichton
c5229e5d2e core: Inhert ~/@/& cmp traits, remove old modules
This commit removes the std::{managed, reference} modules. The modules serve
essentially no purpose, and the only free function removed was `managed::ptr_eq`
which can be achieved by comparing references.

[breaking-change]
2014-05-07 08:15:58 -07:00
Alex Crichton
5592a8f5db core: Inherit the cmp module
This removes the TotalOrd and TotalEq implementation macros, they will be added
later to the numeric modules (where the other comparison implementations live).
2014-05-07 08:15:19 -07:00
Alex Crichton
b024ba544c core: Inherit the iter module 2014-05-07 08:14:56 -07:00
Alex Crichton
06fcb6b1c8 core: Inherit the option module 2014-05-07 08:14:56 -07:00
Alex Crichton
6636215a44 core: Inherit the bool module 2014-05-07 08:14:56 -07:00
Alex Crichton
92095d125a core: Inherit the tuple module 2014-05-07 08:14:54 -07:00
Alex Crichton
1a989d6769 core: Bring clone tests up to date in style 2014-05-07 08:14:26 -07:00
Alex Crichton
54b81997f3 core: Inherit the clone module 2014-05-07 08:13:56 -07:00
Alex Crichton
e7eed5f670 core: Inherit the unit module 2014-05-07 08:13:56 -07:00
Alex Crichton
dfd967f239 core: Inherit the default module 2014-05-07 08:13:56 -07:00
Alex Crichton
17cb238ee8 core: Inherit the raw module 2014-05-07 08:13:56 -07:00
Alex Crichton
8ed728babb core: Inherit the any module 2014-05-07 08:13:56 -07:00
Alex Crichton
85a8e6b80a core: Inherit the finally module 2014-05-07 08:13:24 -07:00
Alex Crichton
7192452545 core: Inherit the char module 2014-05-07 08:13:24 -07:00
Alex Crichton
d9708539af core: Inherit the container module 2014-05-07 08:13:24 -07:00
Alex Crichton
2ad98fbb27 core: Inherit the ty module 2014-05-07 08:13:24 -07:00
Alex Crichton
ead6e16a60 core: Inherit the ops module 2014-05-07 08:13:06 -07:00
Alex Crichton
ec8a805b6d core: Inherit the kinds module 2014-05-07 08:13:06 -07:00
Alex Crichton
28624661c3 core: Inherit the cast module 2014-05-07 08:13:06 -07:00
Alex Crichton
645b157564 core: Inherit the ptr module 2014-05-07 08:13:06 -07:00
Alex Crichton
dca8a0d6e4 core: Inherit the mem module 2014-05-07 08:12:48 -07:00
Alex Crichton
5b75e44fb0 core: Inherit the intrinsics module 2014-05-07 08:12:48 -07:00
Alex Crichton
836d4b96a9 mk: Add libcore 2014-05-07 08:12:48 -07:00
bors
445988b478 auto merge of #13832 : alexcrichton/rust/cfail-full, r=brson
Compile-fail tests for syntax extensions belong in this suite which has correct
dependencies on all artifacts rather than just the target artifacts.

Closes #13818
2014-05-07 08:11:52 -07:00
Alex Crichton
678b1659f9 std: Implement the Buffer trait for some wrappers
This will allow methods like read_line() on RefReader, LimitReader, etc.
2014-05-07 08:11:19 -07:00
bors
f83cf6cf2a auto merge of #13967 : richo/rust/features/ICE-fails, r=alexcrichton
This change makes internal compile errors in the compile-fail tests failures.

I believe this is the correct behaviour- those tests are intended to assert that the compiler doesn't proceed, not that it explodes.

So far, it fails on 4 tests in my environment, my testcase for #13943 which is what caused me to tackle this, and 3 others:

```
failures:
    [compile-fail] compile-fail/incompatible-tuple.rs # This one is mine and not on master
    [compile-fail] compile-fail/inherit-struct8.rs
    [compile-fail] compile-fail/issue-9725.rs
    [compile-fail] compile-fail/unsupported-cast.rs
```
2014-05-07 06:46:54 -07:00
bors
ef6daf9935 auto merge of #13958 : pcwalton/rust/detilde, r=pcwalton
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

r? @brson or @alexcrichton or whoever
2014-05-07 05:16:48 -07:00
bors
4a5d39001b auto merge of #13914 : alexcrichton/rust/pile-o-rustdoc-fixes, r=brson
Lots of assorted things here and there, all the details are in the commits.

Closes #11712
2014-05-07 03:21:47 -07:00