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.
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.
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]
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).
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.
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]
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.
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.
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.
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]
This removes the TotalOrd and TotalEq implementation macros, they will be added
later to the numeric modules (where the other comparison implementations live).
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
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
```
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
for `~str`/`~[]`.
Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.
How to update your code:
* Instead of `~EXPR`, you should write `box EXPR`.
* Instead of `~TYPE`, you should write `Box<Type>`.
* Instead of `~PATTERN`, you should write `box PATTERN`.
[breaking-change]